(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
        typeof define === 'function' && define.amd ? define(['jquery'], factory) :
            (factory(global.$));
}(this, (function ($$1) {
    'use strict';

    $$1 = $$1 && $$1.hasOwnProperty('default') ? $$1['default'] : $$1;

    var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
        return typeof obj;
    } : function (obj) {
        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
    };

    var classCallCheck = function (instance, Constructor) {
        if (!(instance instanceof Constructor)) {
            throw new TypeError("Cannot call a class as a function");
        }
    };

    var createClass = function () {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || false;
                descriptor.configurable = true;
                if ("value" in descriptor) descriptor.writable = true;
                Object.defineProperty(target, descriptor.key, descriptor);
            }
        }

        return function (Constructor, protoProps, staticProps) {
            if (protoProps) defineProperties(Constructor.prototype, protoProps);
            if (staticProps) defineProperties(Constructor, staticProps);
            return Constructor;
        };
    }();

    /*!
   * UAParser.js v0.7.18
   * Lightweight JavaScript-based User-Agent string parser
   * https://github.com/faisalman/ua-parser-js
   *
   * Copyright © 2012-2016 Faisal Salman <fyzlman@gmail.com>
   * Dual licensed under GPLv2 or MIT
   */
    (function (window, undefined) {
        var LIBVERSION = "0.7.18",
            EMPTY = "",
            UNKNOWN = "?",
            FUNC_TYPE = "function",
            UNDEF_TYPE = "undefined",
            OBJ_TYPE = "object",
            STR_TYPE = "string",
            MAJOR = "major",
            MODEL = "model",
            NAME = "name",
            TYPE = "type",
            VENDOR = "vendor",
            VERSION = "version",
            ARCHITECTURE = "architecture",
            CONSOLE = "console",
            MOBILE = "mobile",
            TABLET = "tablet",
            SMARTTV = "smarttv",
            WEARABLE = "wearable",
            EMBEDDED = "embedded";
        var util = {
            extend: function extend(regexes, extensions) {
                var margedRegexes = {};
                for (var i in regexes) {
                    if (extensions[i] && extensions[i].length % 2 === 0) {
                        margedRegexes[i] = extensions[i].concat(regexes[i]);
                    } else {
                        margedRegexes[i] = regexes[i];
                    }
                }
                return margedRegexes;
            }, has: function has(str1, str2) {
                if (typeof str1 === "string") {
                    return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
                } else {
                    return false;
                }
            }, lowerize: function lowerize(str) {
                return str.toLowerCase();
            }, major: function major(version) {
                return (typeof version === "undefined" ? "undefined" : _typeof(version)) === STR_TYPE ? version.replace(/[^\d\.]/g, "").split(".")[0] : undefined;
            }, trim: function trim(str) {
                return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
            }
        };
        var mapper = {
            rgx: function rgx(ua, arrays) {
                var i = 0,
                    j,
                    k,
                    p,
                    q,
                    matches,
                    match;
                while (i < arrays.length && !matches) {
                    var regex = arrays[i],
                        props = arrays[i + 1];
                    j = k = 0;
                    while (j < regex.length && !matches) {
                        matches = regex[j++].exec(ua);
                        if (!!matches) {
                            for (p = 0; p < props.length; p++) {
                                match = matches[++k];
                                q = props[p];
                                if ((typeof q === "undefined" ? "undefined" : _typeof(q)) === OBJ_TYPE && q.length > 0) {
                                    if (q.length == 2) {
                                        if (_typeof(q[1]) == FUNC_TYPE) {
                                            this[q[0]] = q[1].call(this, match);
                                        } else {
                                            this[q[0]] = q[1];
                                        }
                                    } else if (q.length == 3) {
                                        if (_typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) {
                                            this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
                                        } else {
                                            this[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
                                        }
                                    } else if (q.length == 4) {
                                        this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
                                    }
                                } else {
                                    this[q] = match ? match : undefined;
                                }
                            }
                        }
                    }
                    i += 2;
                }
            }, str: function str(_str, map) {
                for (var i in map) {
                    if (_typeof(map[i]) === OBJ_TYPE && map[i].length > 0) {
                        for (var j = 0; j < map[i].length; j++) {
                            if (util.has(map[i][j], _str)) {
                                return i === UNKNOWN ? undefined : i;
                            }
                        }
                    } else if (util.has(map[i], _str)) {
                        return i === UNKNOWN ? undefined : i;
                    }
                }
                return _str;
            }
        };
        var maps = {
            browser: {
                oldsafari: {
                    version: {
                        "1.0": "/8",
                        1.2: "/1",
                        1.3: "/3",
                        "2.0": "/412",
                        "2.0.2": "/416",
                        "2.0.3": "/417",
                        "2.0.4": "/419",
                        "?": "/"
                    }
                }
            },
            device: {
                amazon: {model: {"Fire Phone": ["SD", "KF"]}},
                sprint: {model: {"Evo Shift 4G": "7373KT"}, vendor: {HTC: "APA", Sprint: "Sprint"}}
            },
            os: {
                windows: {
                    version: {
                        ME: "4.90",
                        "NT 3.11": "NT3.51",
                        "NT 4.0": "NT4.0",
                        2000: "NT 5.0",
                        XP: ["NT 5.1", "NT 5.2"],
                        Vista: "NT 6.0",
                        7: "NT 6.1",
                        8: "NT 6.2",
                        8.1: "NT 6.3",
                        10: ["NT 6.4", "NT 10.0"],
                        RT: "ARM"
                    }
                }
            }
        };
        var regexes = {
            browser: [[/(opera\smini)\/([\w\.-]+)/i, /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, /(opera).+version\/([\w\.]+)/i, /(opera)[\/\s]+([\w\.]+)/i], [NAME, VERSION], [/(opios)[\/\s]+([\w\.]+)/i], [[NAME, "Opera Mini"], VERSION], [/\s(opr)\/([\w\.]+)/i], [[NAME, "Opera"], VERSION], [/(kindle)\/([\w\.]+)/i, /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i, /(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i, /(?:ms|\()(ie)\s([\w\.]+)/i, /(rekonq)\/([\w\.]*)/i, /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i], [NAME, VERSION], [/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i], [[NAME, "IE"], VERSION], [/(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i], [[NAME, "Edge"], VERSION], [/(yabrowser)\/([\w\.]+)/i], [[NAME, "Yandex"], VERSION], [/(puffin)\/([\w\.]+)/i], [[NAME, "Puffin"], VERSION], [/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i], [[NAME, "UCBrowser"], VERSION], [/(comodo_dragon)\/([\w\.]+)/i], [[NAME, /_/g, " "], VERSION], [/(micromessenger)\/([\w\.]+)/i], [[NAME, "WeChat"], VERSION], [/(qqbrowserlite)\/([\w\.]+)/i], [NAME, VERSION], [/(QQ)\/([\d\.]+)/i], [NAME, VERSION], [/m?(qqbrowser)[\/\s]?([\w\.]+)/i], [NAME, VERSION], [/(BIDUBrowser)[\/\s]?([\w\.]+)/i], [NAME, VERSION], [/(2345Explorer)[\/\s]?([\w\.]+)/i], [NAME, VERSION], [/(MetaSr)[\/\s]?([\w\.]+)/i], [NAME], [/(LBBROWSER)/i], [NAME], [/xiaomi\/miuibrowser\/([\w\.]+)/i], [VERSION, [NAME, "MIUI Browser"]], [/;fbav\/([\w\.]+);/i], [VERSION, [NAME, "Facebook"]], [/headlesschrome(?:\/([\w\.]+)|\s)/i], [VERSION, [NAME, "Chrome Headless"]], [/\swv\).+(chrome)\/([\w\.]+)/i], [[NAME, /(.+)/, "$1 WebView"], VERSION], [/((?:oculus|samsung)browser)\/([\w\.]+)/i], [[NAME, /(.+(?:g|us))(.+)/, "$1 $2"], VERSION], [/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i], [VERSION, [NAME, "Android Browser"]], [/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i], [NAME, VERSION], [/(dolfin)\/([\w\.]+)/i], [[NAME, "Dolphin"], VERSION], [/((?:android.+)crmo|crios)\/([\w\.]+)/i], [[NAME, "Chrome"], VERSION], [/(coast)\/([\w\.]+)/i], [[NAME, "Opera Coast"], VERSION], [/fxios\/([\w\.-]+)/i], [VERSION, [NAME, "Firefox"]], [/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i], [VERSION, [NAME, "Mobile Safari"]], [/version\/([\w\.]+).+?(mobile\s?safari|safari)/i], [VERSION, NAME], [/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i], [[NAME, "GSA"], VERSION], [/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i], [NAME, [VERSION, mapper.str, maps.browser.oldsafari.version]], [/(konqueror)\/([\w\.]+)/i, /(webkit|khtml)\/([\w\.]+)/i], [NAME, VERSION], [/(navigator|netscape)\/([\w\.-]+)/i], [[NAME, "Netscape"], VERSION], [/(swiftfox)/i, /(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i, /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i, /(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i, /(links)\s\(([\w\.]+)/i, /(gobrowser)\/?([\w\.]*)/i, /(ice\s?browser)\/v?([\w\._]+)/i, /(mosaic)[\/\s]([\w\.]+)/i], [NAME, VERSION]],
            cpu: [[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i], [[ARCHITECTURE, "amd64"]], [/(ia32(?=;))/i], [[ARCHITECTURE, util.lowerize]], [/((?:i[346]|x)86)[;\)]/i], [[ARCHITECTURE, "ia32"]], [/windows\s(ce|mobile);\sppc;/i], [[ARCHITECTURE, "arm"]], [/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i], [[ARCHITECTURE, /ower/, "", util.lowerize]], [/(sun4\w)[;\)]/i], [[ARCHITECTURE, "sparc"]], [/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i], [[ARCHITECTURE, util.lowerize]]],
            device: [[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i], [MODEL, VENDOR, [TYPE, TABLET]], [/applecoremedia\/[\w\.]+ \((ipad)/], [MODEL, [VENDOR, "Apple"], [TYPE, TABLET]], [/(apple\s{0,1}tv)/i], [[MODEL, "Apple TV"], [VENDOR, "Apple"]], [/(archos)\s(gamepad2?)/i, /(hp).+(touchpad)/i, /(hp).+(tablet)/i, /(kindle)\/([\w\.]+)/i, /\s(nook)[\w\s]+build\/(\w+)/i, /(dell)\s(strea[kpr\s\d]*[\dko])/i], [VENDOR, MODEL, [TYPE, TABLET]], [/(kf[A-z]+)\sbuild\/.+silk\//i], [MODEL, [VENDOR, "Amazon"], [TYPE, TABLET]], [/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i], [[MODEL, mapper.str, maps.device.amazon.model], [VENDOR, "Amazon"], [TYPE, MOBILE]], [/\((ip[honed|\s\w*]+);.+(apple)/i], [MODEL, VENDOR, [TYPE, MOBILE]], [/\((ip[honed|\s\w*]+);/i], [MODEL, [VENDOR, "Apple"], [TYPE, MOBILE]], [/(blackberry)[\s-]?(\w+)/i, /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i, /(hp)\s([\w\s]+\w)/i, /(asus)-?(\w+)/i], [VENDOR, MODEL, [TYPE, MOBILE]], [/\(bb10;\s(\w+)/i], [MODEL, [VENDOR, "BlackBerry"], [TYPE, MOBILE]], [/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i], [MODEL, [VENDOR, "Asus"], [TYPE, TABLET]], [/(sony)\s(tablet\s[ps])\sbuild\//i, /(sony)?(?:sgp.+)\sbuild\//i], [[VENDOR, "Sony"], [MODEL, "Xperia Tablet"], [TYPE, TABLET]], [/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i], [MODEL, [VENDOR, "Sony"], [TYPE, MOBILE]], [/\s(ouya)\s/i, /(nintendo)\s([wids3u]+)/i], [VENDOR, MODEL, [TYPE, CONSOLE]], [/android.+;\s(shield)\sbuild/i], [MODEL, [VENDOR, "Nvidia"], [TYPE, CONSOLE]], [/(playstation\s[34portablevi]+)/i], [MODEL, [VENDOR, "Sony"], [TYPE, CONSOLE]], [/(sprint\s(\w+))/i], [[VENDOR, mapper.str, maps.device.sprint.vendor], [MODEL, mapper.str, maps.device.sprint.model], [TYPE, MOBILE]], [/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i], [VENDOR, MODEL, [TYPE, TABLET]], [/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, /(zte)-(\w*)/i, /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i], [VENDOR, [MODEL, /_/g, " "], [TYPE, MOBILE]], [/(nexus\s9)/i], [MODEL, [VENDOR, "HTC"], [TYPE, TABLET]], [/d\/huawei([\w\s-]+)[;\)]/i, /(nexus\s6p)/i], [MODEL, [VENDOR, "Huawei"], [TYPE, MOBILE]], [/(microsoft);\s(lumia[\s\w]+)/i], [VENDOR, MODEL, [TYPE, MOBILE]], [/[\s\(;](xbox(?:\sone)?)[\s\);]/i], [MODEL, [VENDOR, "Microsoft"], [TYPE, CONSOLE]], [/(kin\.[onetw]{3})/i], [[MODEL, /\./g, " "], [VENDOR, "Microsoft"], [TYPE, MOBILE]], [/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i, /mot[\s-]?(\w*)/i, /(XT\d{3,4}) build\//i, /(nexus\s6)/i], [MODEL, [VENDOR, "Motorola"], [TYPE, MOBILE]], [/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i], [MODEL, [VENDOR, "Motorola"], [TYPE, TABLET]], [/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i], [[VENDOR, util.trim], [MODEL, util.trim], [TYPE, SMARTTV]], [/hbbtv.+maple;(\d+)/i], [[MODEL, /^/, "SmartTV"], [VENDOR, "Samsung"], [TYPE, SMARTTV]], [/\(dtv[\);].+(aquos)/i], [MODEL, [VENDOR, "Sharp"], [TYPE, SMARTTV]], [/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i], [[VENDOR, "Samsung"], MODEL, [TYPE, TABLET]], [/smart-tv.+(samsung)/i], [VENDOR, [TYPE, SMARTTV], MODEL], [/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i, /(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i, /sec-((sgh\w+))/i], [[VENDOR, "Samsung"], MODEL, [TYPE, MOBILE]], [/sie-(\w*)/i], [MODEL, [VENDOR, "Siemens"], [TYPE, MOBILE]], [/(maemo|nokia).*(n900|lumia\s\d+)/i, /(nokia)[\s_-]?([\w-]*)/i], [[VENDOR, "Nokia"], MODEL, [TYPE, MOBILE]], [/android\s3\.[\s\w;-]{10}(a\d{3})/i], [MODEL, [VENDOR, "Acer"], [TYPE, TABLET]], [/android.+([vl]k\-?\d{3})\s+build/i], [MODEL, [VENDOR, "LG"], [TYPE, TABLET]], [/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i], [[VENDOR, "LG"], MODEL, [TYPE, TABLET]], [/(lg) netcast\.tv/i], [VENDOR, MODEL, [TYPE, SMARTTV]], [/(nexus\s[45])/i, /lg[e;\s\/-]+(\w*)/i, /android.+lg(\-?[\d\w]+)\s+build/i], [MODEL, [VENDOR, "LG"], [TYPE, MOBILE]], [/android.+(ideatab[a-z0-9\-\s]+)/i], [MODEL, [VENDOR, "Lenovo"], [TYPE, TABLET]], [/linux;.+((jolla));/i], [VENDOR, MODEL, [TYPE, MOBILE]], [/((pebble))app\/[\d\.]+\s/i], [VENDOR, MODEL, [TYPE, WEARABLE]], [/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i], [VENDOR, MODEL, [TYPE, MOBILE]], [/crkey/i], [[MODEL, "Chromecast"], [VENDOR, "Google"]], [/android.+;\s(glass)\s\d/i], [MODEL, [VENDOR, "Google"], [TYPE, WEARABLE]], [/android.+;\s(pixel c)\s/i], [MODEL, [VENDOR, "Google"], [TYPE, TABLET]], [/android.+;\s(pixel xl|pixel)\s/i], [MODEL, [VENDOR, "Google"], [TYPE, MOBILE]], [/android.+;\s(\w+)\s+build\/hm\1/i, /android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i, /android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i], [[MODEL, /_/g, " "], [VENDOR, "Xiaomi"], [TYPE, MOBILE]], [/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i], [[MODEL, /_/g, " "], [VENDOR, "Xiaomi"], [TYPE, TABLET]], [/android.+;\s(m[1-5]\snote)\sbuild/i], [MODEL, [VENDOR, "Meizu"], [TYPE, TABLET]], [/android.+a000(1)\s+build/i, /android.+oneplus\s(a\d{4})\s+build/i], [MODEL, [VENDOR, "OnePlus"], [TYPE, MOBILE]], [/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i], [MODEL, [VENDOR, "RCA"], [TYPE, TABLET]], [/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i], [MODEL, [VENDOR, "Dell"], [TYPE, TABLET]], [/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i], [MODEL, [VENDOR, "Verizon"], [TYPE, TABLET]], [/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i], [[VENDOR, "Barnes & Noble"], MODEL, [TYPE, TABLET]], [/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i], [MODEL, [VENDOR, "NuVision"], [TYPE, TABLET]], [/android.+;\s(k88)\sbuild/i], [MODEL, [VENDOR, "ZTE"], [TYPE, TABLET]], [/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i], [MODEL, [VENDOR, "Swiss"], [TYPE, MOBILE]], [/android.+[;\/]\s*(zur\d{3})\s+build/i], [MODEL, [VENDOR, "Swiss"], [TYPE, TABLET]], [/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i], [MODEL, [VENDOR, "Zeki"], [TYPE, TABLET]], [/(android).+[;\/]\s+([YR]\d{2})\s+build/i, /android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i], [[VENDOR, "Dragon Touch"], MODEL, [TYPE, TABLET]], [/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i], [MODEL, [VENDOR, "Insignia"], [TYPE, TABLET]], [/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i], [MODEL, [VENDOR, "NextBook"], [TYPE, TABLET]], [/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i], [[VENDOR, "Voice"], MODEL, [TYPE, MOBILE]], [/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i], [[VENDOR, "LvTel"], MODEL, [TYPE, MOBILE]], [/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i], [MODEL, [VENDOR, "Envizen"], [TYPE, TABLET]], [/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i], [VENDOR, MODEL, [TYPE, TABLET]], [/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i], [MODEL, [VENDOR, "MachSpeed"], [TYPE, TABLET]], [/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i], [VENDOR, MODEL, [TYPE, TABLET]], [/android.+[;\/]\s*TU_(1491)\s+build/i], [MODEL, [VENDOR, "Rotor"], [TYPE, TABLET]], [/android.+(KS(.+))\s+build/i], [MODEL, [VENDOR, "Amazon"], [TYPE, TABLET]], [/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i], [VENDOR, MODEL, [TYPE, TABLET]], [/\s(tablet|tab)[;\/]/i, /\s(mobile)(?:[;\/]|\ssafari)/i], [[TYPE, util.lowerize], VENDOR, MODEL], [/(android[\w\.\s\-]{0,9});.+build/i], [MODEL, [VENDOR, "Generic"]]],
            engine: [[/windows.+\sedge\/([\w\.]+)/i], [VERSION, [NAME, "EdgeHTML"]], [/(presto)\/([\w\.]+)/i, /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, /(icab)[\/\s]([23]\.[\d\.]+)/i], [NAME, VERSION], [/rv\:([\w\.]{1,9}).+(gecko)/i], [VERSION, NAME]],
            os: [[/microsoft\s(windows)\s(vista|xp)/i], [NAME, VERSION], [/(windows)\snt\s6\.2;\s(arm)/i, /(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i, /(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i], [[NAME, "Windows"], [VERSION, mapper.str, maps.os.windows.version]], [/\((bb)(10);/i], [[NAME, "BlackBerry"], VERSION], [/(blackberry)\w*\/?([\w\.]*)/i, /(tizen)[\/\s]([\w\.]+)/i, /(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]*)/i, /linux;.+(sailfish);/i], [NAME, VERSION], [/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i], [[NAME, "Symbian"], VERSION], [/\((series40);/i], [NAME], [/mozilla.+\(mobile;.+gecko.+firefox/i], [[NAME, "Firefox OS"], VERSION], [/(nintendo|playstation)\s([wids34portablevu]+)/i, /(mint)[\/\s\(]?(\w*)/i, /(mageia|vectorlinux)[;\s]/i, /(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i, /(hurd|linux)\s?([\w\.]*)/i, /(gnu)\s?([\w\.]*)/i], [NAME, VERSION], [/(cros)\s[\w]+\s([\w\.]+\w)/i], [[NAME, "Chromium OS"], VERSION], [/(sunos)\s?([\w\.\d]*)/i], [[NAME, "Solaris"], VERSION], [/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i], [NAME, VERSION], [/(haiku)\s(\w+)/i], [NAME, VERSION], [/cfnetwork\/.+darwin/i, /ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i], [[VERSION, /_/g, "."], [NAME, "iOS"]], [/(mac\sos\sx)\s?([\w\s\.]*)/i, /(macintosh|mac(?=_powerpc)\s)/i], [[NAME, "Mac OS"], [VERSION, /_/g, "."]], [/((?:open)?solaris)[\/\s-]?([\w\.]*)/i, /(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i, /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, /(unix)\s?([\w\.]*)/i], [NAME, VERSION]]
        };
        var UAParser = function UAParser(uastring, extensions) {
            if ((typeof uastring === "undefined" ? "undefined" : _typeof(uastring)) === "object") {
                extensions = uastring;
                uastring = undefined;
            }
            if (!(this instanceof UAParser)) {
                return new UAParser(uastring, extensions).getResult();
            }
            var ua = uastring || (window && window.navigator && window.navigator.userAgent ? window.navigator.userAgent : EMPTY);
            var rgxmap = extensions ? util.extend(regexes, extensions) : regexes;
            this.getBrowser = function () {
                var browser = {name: undefined, version: undefined};
                mapper.rgx.call(browser, ua, rgxmap.browser);
                browser.major = util.major(browser.version);
                return browser;
            };
            this.getCPU = function () {
                var cpu = {architecture: undefined};
                mapper.rgx.call(cpu, ua, rgxmap.cpu);
                return cpu;
            };
            this.getDevice = function () {
                var device = {vendor: undefined, model: undefined, type: undefined};
                mapper.rgx.call(device, ua, rgxmap.device);
                return device;
            };
            this.getEngine = function () {
                var engine = {name: undefined, version: undefined};
                mapper.rgx.call(engine, ua, rgxmap.engine);
                return engine;
            };
            this.getOS = function () {
                var os = {name: undefined, version: undefined};
                mapper.rgx.call(os, ua, rgxmap.os);
                return os;
            };
            this.getResult = function () {
                return {
                    ua: this.getUA(),
                    browser: this.getBrowser(),
                    engine: this.getEngine(),
                    os: this.getOS(),
                    device: this.getDevice(),
                    cpu: this.getCPU()
                };
            };
            this.getUA = function () {
                return ua;
            };
            this.setUA = function (uastring) {
                ua = uastring;
                return this;
            };
            return this;
        };
        UAParser.VERSION = LIBVERSION;
        UAParser.BROWSER = {NAME: NAME, MAJOR: MAJOR, VERSION: VERSION};
        UAParser.CPU = {ARCHITECTURE: ARCHITECTURE};
        UAParser.DEVICE = {
            MODEL: MODEL,
            VENDOR: VENDOR,
            TYPE: TYPE,
            CONSOLE: CONSOLE,
            MOBILE: MOBILE,
            SMARTTV: SMARTTV,
            TABLET: TABLET,
            WEARABLE: WEARABLE,
            EMBEDDED: EMBEDDED
        };
        UAParser.ENGINE = {NAME: NAME, VERSION: VERSION};
        UAParser.OS = {NAME: NAME, VERSION: VERSION};
        if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) !== UNDEF_TYPE) {
            if ((typeof module === "undefined" ? "undefined" : _typeof(module)) !== UNDEF_TYPE && module.exports) {
                exports = module.exports = UAParser;
            }
            exports.UAParser = UAParser;
        } else {
            if ((typeof define === "undefined" ? "undefined" : _typeof(define)) === FUNC_TYPE && define.amd) {
                define(function () {
                    return UAParser;
                });
            } else if (window) {
                window.UAParser = UAParser;
            }
        }
        var $ = window && (window.jQuery || window.Zepto);
        if ((typeof $ === "undefined" ? "undefined" : _typeof($)) !== UNDEF_TYPE) {
            var parser = new UAParser();
            $.ua = parser.getResult();
            $.ua.get = function () {
                return parser.getUA();
            };
            $.ua.set = function (uastring) {
                parser.setUA(uastring);
                var result = parser.getResult();
                for (var prop in result) {
                    $.ua[prop] = result[prop];
                }
            };
        }
    })((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" ? window : undefined);

    var osName = $.ua.os.name.toLowerCase();
    var osVersion = $.ua.os.version.toLowerCase();

    // 如果是 Windows 7 及以下的机器，使用 tiny-font-weight 渲染页面
    // 因为在 Windows 7 下大号的微软雅黑加粗字体非常难看
    if (osName === 'windows' && ['7', 'xp', 'vista'].indexOf(osVersion) > -1) {
        $('body').addClass('tiny-font-weight');
    }

    /* ========================================================================
   * Bootstrap: transition.js v3.4.0
   * http://getbootstrap.com/javascript/#transitions
   * ========================================================================
   * Copyright 2011-2016 Twitter, Inc.
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * ======================================================================== */

    +function ($) {

        // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
        // ============================================================

        function transitionEnd() {
            var el = document.createElement('bootstrap');

            var transEndEventNames = {
                WebkitTransition: 'webkitTransitionEnd',
                MozTransition: 'transitionend',
                OTransition: 'oTransitionEnd otransitionend',
                transition: 'transitionend'
            };

            for (var name in transEndEventNames) {
                if (el.style[name] !== undefined) {
                    return {end: transEndEventNames[name]};
                }
            }

            return false; // explicit for ie8 (  ._.)
        }

        // http://blog.alexmaccaw.com/css-transitions
        $.fn.emulateTransitionEnd = function (duration) {
            var called = false;
            var $el = this;
            $(this).one('bsTransitionEnd', function () {
                called = true;
            });
            var callback = function callback() {
                if (!called) $($el).trigger($.support.transition.end);
            };
            setTimeout(callback, duration);
            return this;
        };

        $(function () {
            $.support.transition = transitionEnd();

            if (!$.support.transition) return;

            $.event.special.bsTransitionEnd = {
                bindType: $.support.transition.end,
                delegateType: $.support.transition.end,
                handle: function handle(e) {
                    if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments);
                }
            };
        });
    }(jQuery);

    var Tab = function () {
        function Tab(element) {
            classCallCheck(this, Tab);

            this.element = $$1(element);
        }

        createClass(Tab, [{
            key: 'show',
            value: function show() {
                var $this = this.element;
                var $ul = $this.closest('ul');
                var selector = $this.data('target');

                if (!selector) {
                    selector = $this.attr('href');
                    selector = selector && selector.replace(/.*(?=#[^\s]*$)/, ''); // strip for ie7
                }

                if ($this.parent('li').hasClass('active')) return;

                var $previous = $ul.find('.active:last a');
                var hideEvent = $$1.Event('hide.tabs', {relatedTarget: $previous[0]});
                var showEvent = $$1.Event('show.tabs', {relatedTarget: $previous[0]});

                $previous.trigger(hideEvent);
                $this.trigger(showEvent);

                if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return;

                var $target = $$1(selector);

                this.activate($this.closest('li'), $ul);
                this.activate($target, $target.parent(), function () {
                    $previous.trigger({
                        type: 'hidden.tabs',
                        relatedTarget: $this[0]
                    });

                    $this.trigger({
                        type: 'shown.tabs',
                        relatedTarget: $previous[0]
                    });
                });
            }

            // 显示 tabs-panel

        }, {
            key: 'activate',
            value: function activate(element, container, callback) {
                var $active = container.find('> .active');
                var transition = callback && $$1.support.transition && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length);

                var next = function next() {
                    $active.removeClass('active');
                    element.addClass('active');

                    if (transition) {
                        element[0].offsetWidth;
                        element.addClass('in');
                    } else {
                        element.removeClass('fade');
                    }

                    typeof callback === 'function' && callback();
                };

                $active.length && transition ? $active.one('bsTransitionEnd', next).emulateTransitionEnd(Tab.TRANSITION_DURATION) : next();

                $active.removeClass('in');
            }
        }]);
        return Tab;
    }();

    // 版本号


    Tab.version = '1.0.0';

    // 动画间隔时间
    Tab.TRANSITION_DURATION = 150;

    function Plugin(option) {
        return this.each(function () {
            var $this = $$1(this);
            var data = $this.data('tabs');

            if (!data) $this.data('tabs', data = new Tab(this));
            if (typeof option === 'string') data[option]();
        });
    }

    var old = $$1.fn.tabs;

    $$1.fn.tabs = Plugin;
    $$1.fn.tabs.Constructor = Tab;
    $$1.fn.tabs.noConflict = function () {
        $$1.fn.tabs = old;
        return this;
    };

    // 自动绑定
    function bindClick(e) {
        e.preventDefault();
        Plugin.call($$1(this), 'show');
    }

    $$1(document).on('click.tabs.data-api', '[data-toggle="tab"]', bindClick);

    /* ========================================================================
   * Bootstrap: modal.js v3.4.0
   * http://getbootstrap.com/javascript/#modals
   * ========================================================================
   * Copyright 2011-2016 Twitter, Inc.
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * ======================================================================== */

    +function ($) {

        // MODAL CLASS DEFINITION
        // ======================

        var Modal = function Modal(element, options) {
            this.options = options;
            this.$body = $(document.body);
            this.$element = $(element);
            this.$dialog = this.$element.find('.modal-dialog');
            this.$backdrop = null;
            this.isShown = null;
            this.originalBodyPad = null;
            this.scrollbarWidth = 0;
            this.ignoreBackdropClick = false;

            if (this.options.remote) {
                this.$element.find('.modal-content').load(this.options.remote, $.proxy(function () {
                    this.$element.trigger('loaded.bs.modal');
                }, this));
            }
        };

        Modal.VERSION = '3.4.0';

        Modal.TRANSITION_DURATION = 300;
        Modal.BACKDROP_TRANSITION_DURATION = 150;

        Modal.DEFAULTS = {
            backdrop: true,
            keyboard: true,
            show: true
        };

        Modal.prototype.toggle = function (_relatedTarget) {
            return this.isShown ? this.hide() : this.show(_relatedTarget);
        };

        Modal.prototype.show = function (_relatedTarget) {
            var that = this;
            var e = $.Event('show.bs.modal', {relatedTarget: _relatedTarget});

            this.$element.trigger(e);

            if (this.isShown || e.isDefaultPrevented()) return;

            this.isShown = true;

            this.checkScrollbar();
            this.setScrollbar();
            this.$body.addClass('modal-open');

            this.escape();
            this.resize();

            this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this));

            this.$dialog.on('mousedown.dismiss.bs.modal', function () {
                that.$element.one('mouseup.dismiss.bs.modal', function (e) {
                    if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true;
                });
            });

            this.backdrop(function () {
                var transition = $.support.transition && that.$element.hasClass('fade');

                if (!that.$element.parent().length) {
                    that.$element.appendTo(that.$body); // don't move modals dom position
                }

                that.$element.show().scrollTop(0);

                that.adjustDialog();

                if (transition) {
                    that.$element[0].offsetWidth; // force reflow
                }

                that.$element.addClass('in');

                that.enforceFocus();

                var e = $.Event('shown.bs.modal', {relatedTarget: _relatedTarget});

                transition ? that.$dialog // wait for modal to slide in
                    .one('bsTransitionEnd', function () {
                        that.$element.trigger('focus').trigger(e);
                    }).emulateTransitionEnd(Modal.TRANSITION_DURATION) : that.$element.trigger('focus').trigger(e);
            });
        };

        Modal.prototype.hide = function (e) {
            if (e) e.preventDefault();

            e = $.Event('hide.bs.modal');

            this.$element.trigger(e);

            if (!this.isShown || e.isDefaultPrevented()) return;

            this.isShown = false;

            this.escape();
            this.resize();

            $(document).off('focusin.bs.modal');

            this.$element.removeClass('in').off('click.dismiss.bs.modal').off('mouseup.dismiss.bs.modal');

            this.$dialog.off('mousedown.dismiss.bs.modal');

            $.support.transition && this.$element.hasClass('fade') ? this.$element.one('bsTransitionEnd', $.proxy(this.hideModal, this)).emulateTransitionEnd(Modal.TRANSITION_DURATION) : this.hideModal();
        };

        Modal.prototype.enforceFocus = function () {
            $(document).off('focusin.bs.modal') // guard against infinite focus loop
                .on('focusin.bs.modal', $.proxy(function (e) {
                    if (document !== e.target && this.$element[0] !== e.target && !this.$element.has(e.target).length) {
                        this.$element.trigger('focus');
                    }
                }, this));
        };

        Modal.prototype.escape = function () {
            if (this.isShown && this.options.keyboard) {
                this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
                    e.which == 27 && this.hide();
                }, this));
            } else if (!this.isShown) {
                this.$element.off('keydown.dismiss.bs.modal');
            }
        };

        Modal.prototype.resize = function () {
            if (this.isShown) {
                $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this));
            } else {
                $(window).off('resize.bs.modal');
            }
        };

        Modal.prototype.hideModal = function () {
            var that = this;
            this.$element.hide();
            this.backdrop(function () {
                that.$body.removeClass('modal-open');
                that.resetAdjustments();
                that.resetScrollbar();
                that.$element.trigger('hidden.bs.modal');
            });
        };

        Modal.prototype.removeBackdrop = function () {
            this.$backdrop && this.$backdrop.remove();
            this.$backdrop = null;
        };

        Modal.prototype.backdrop = function (callback) {

            //add by bjca begin
            $('.modal-backdrop').remove();
            $('.modal-backdrop in').remove();
            //add by bjca end

            var that = this;
            var animate = this.$element.hasClass('fade') ? 'fade' : '';

            if (this.isShown && this.options.backdrop) {
                var doAnimate = $.support.transition && animate;

                this.$backdrop = $(document.createElement('div')).addClass('modal-backdrop ' + animate).appendTo(this.$body);

                this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
                    if (this.ignoreBackdropClick) {
                        this.ignoreBackdropClick = false;
                        return;
                    }
                    if (e.target !== e.currentTarget) return;
                    this.options.backdrop == 'static' ? this.$element[0].focus() : this.hide();
                }, this));

                if (doAnimate) this.$backdrop[0].offsetWidth; // force reflow

                this.$backdrop.addClass('in');

                if (!callback) return;

                doAnimate ? this.$backdrop.one('bsTransitionEnd', callback).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callback();
            } else if (!this.isShown && this.$backdrop) {
                this.$backdrop.removeClass('in');

                var callbackRemove = function callbackRemove() {
                    that.removeBackdrop();
                    callback && callback();
                };
                $.support.transition && this.$element.hasClass('fade') ? this.$backdrop.one('bsTransitionEnd', callbackRemove).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callbackRemove();
            } else if (callback) {
                callback();
            }
        };

        // these following methods are used to handle overflowing modals

        Modal.prototype.handleUpdate = function () {
            this.adjustDialog();
        };

        Modal.prototype.adjustDialog = function () {
            var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight;

            this.$element.css({
                paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
                paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
            });
        };

        Modal.prototype.resetAdjustments = function () {
            this.$element.css({
                paddingLeft: '',
                paddingRight: ''
            });
        };

        Modal.prototype.checkScrollbar = function () {
            var fullWindowWidth = window.innerWidth;
            if (!fullWindowWidth) {
                // workaround for missing window.innerWidth in IE8
                var documentElementRect = document.documentElement.getBoundingClientRect();
                fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);
            }
            this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth;
            this.scrollbarWidth = this.measureScrollbar();
        };

        Modal.prototype.setScrollbar = function () {
            var bodyPad = parseInt(this.$body.css('padding-right') || 0, 10);
            this.originalBodyPad = document.body.style.paddingRight || '';
            if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth);
        };

        Modal.prototype.resetScrollbar = function () {
            this.$body.css('padding-right', this.originalBodyPad);
        };

        Modal.prototype.measureScrollbar = function () {
            // thx walsh
            var scrollDiv = document.createElement('div');
            scrollDiv.className = 'modal-scrollbar-measure';
            this.$body.append(scrollDiv);
            var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
            this.$body[0].removeChild(scrollDiv);
            return scrollbarWidth;
        };

        // MODAL PLUGIN DEFINITION
        // =======================

        function Plugin(option, _relatedTarget) {
            return this.each(function () {
                var $this = $(this);
                var data = $this.data('bs.modal');
                var options = $.extend({}, Modal.DEFAULTS, $this.data(), (typeof option === 'undefined' ? 'undefined' : _typeof(option)) == 'object' && option);

                if (!data) $this.data('bs.modal', data = new Modal(this, options));
                if (typeof option == 'string') data[option](_relatedTarget); else if (options.show) data.show(_relatedTarget);
            });
        }

        var old = $.fn.modal;

        $.fn.modal = Plugin;
        $.fn.modal.Constructor = Modal;

        // MODAL NO CONFLICT
        // =================

        $.fn.modal.noConflict = function () {
            $.fn.modal = old;
            return this;
        };

        // MODAL DATA-API
        // ==============

        $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
            var $this = $(this);
            var href = $this.attr('href');
            var target = $this.attr('data-target') || href && href.replace(/.*(?=#[^\s]+$)/, ''); // strip for ie7

            var $target = $(document).find(target);
            var option = $target.data('bs.modal') ? 'toggle' : $.extend({remote: !/#/.test(href) && href}, $target.data(), $this.data());

            if ($this.is('a')) e.preventDefault();

            $target.one('show.bs.modal', function (showEvent) {
                if (showEvent.isDefaultPrevented()) return; // only register focus restorer if modal will actually get shown
                $target.one('hidden.bs.modal', function () {
                    $this.is(':visible') && $this.trigger('focus');
                });
            });
            Plugin.call($target, option, this);
        });
    }(jQuery);

    /* ========================================================================
   * Bootstrap: dropdown.js v3.4.0
   * http://getbootstrap.com/javascript/#dropdowns
   * ========================================================================
   * Copyright 2011-2016 Twitter, Inc.
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * ======================================================================== */

    +function ($) {

        // DROPDOWN CLASS DEFINITION
        // =========================

        var backdrop = '.dropdown-backdrop';
        var toggle = '[data-toggle="dropdown"]';
        var Dropdown = function Dropdown(element) {
            $(element).on('click.bs.dropdown', this.toggle);
        };

        Dropdown.VERSION = '3.4.0';

        function getParent($this) {
            var selector = $this.attr('data-target');

            if (!selector) {
                selector = $this.attr('href');
                selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, ''); // strip for ie7
            }

            var $parent = selector && $(document).find(selector);

            return $parent && $parent.length ? $parent : $this.parent();
        }

        function clearMenus(e) {
            if (e && e.which === 3) return;
            $(backdrop).remove();
            $(toggle).each(function () {
                var $this = $(this);
                var $parent = getParent($this);
                var relatedTarget = {relatedTarget: this};

                if (!$parent.hasClass('open')) return;

                if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return;

                $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget));

                if (e.isDefaultPrevented()) return;

                $this.attr('aria-expanded', 'false');
                $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget));
            });
        }

        Dropdown.prototype.toggle = function (e) {
            var $this = $(this);

            if ($this.is('.disabled, :disabled')) return;

            var $parent = getParent($this);
            var isActive = $parent.hasClass('open');

            clearMenus();

            if (!isActive) {
                if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
                    // if mobile we use a backdrop because click events don't delegate
                    $(document.createElement('div')).addClass('dropdown-backdrop').insertAfter($(this)).on('click', clearMenus);
                }

                var relatedTarget = {relatedTarget: this};
                $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget));

                if (e.isDefaultPrevented()) return;

                $this.trigger('focus').attr('aria-expanded', 'true');

                $parent.toggleClass('open').trigger($.Event('shown.bs.dropdown', relatedTarget));
            }

            return false;
        };

        Dropdown.prototype.keydown = function (e) {
            if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return;

            var $this = $(this);

            e.preventDefault();
            e.stopPropagation();

            if ($this.is('.disabled, :disabled')) return;

            var $parent = getParent($this);
            var isActive = $parent.hasClass('open');

            if (!isActive && e.which != 27 || isActive && e.which == 27) {
                if (e.which == 27) $parent.find(toggle).trigger('focus');
                return $this.trigger('click');
            }

            var desc = ' li:not(.disabled):visible a';
            var $items = $parent.find('.dropdown-menu' + desc);

            if (!$items.length) return;

            var index = $items.index(e.target);

            if (e.which == 38 && index > 0) index--; // up
            if (e.which == 40 && index < $items.length - 1) index++; // down
            if (!~index) index = 0;

            $items.eq(index).trigger('focus');
        };

        // DROPDOWN PLUGIN DEFINITION
        // ==========================

        function Plugin(option) {
            return this.each(function () {
                var $this = $(this);
                var data = $this.data('bs.dropdown');

                if (!data) $this.data('bs.dropdown', data = new Dropdown(this));
                if (typeof option == 'string') data[option].call($this);
            });
        }

        var old = $.fn.dropdown;

        $.fn.dropdown = Plugin;
        $.fn.dropdown.Constructor = Dropdown;

        // DROPDOWN NO CONFLICT
        // ====================

        $.fn.dropdown.noConflict = function () {
            $.fn.dropdown = old;
            return this;
        };

        // APPLY TO STANDARD DROPDOWN ELEMENTS
        // ===================================

        $(document).on('click.bs.dropdown.data-api', clearMenus).on('click.bs.dropdown.data-api', '.dropdown form', function (e) {
            e.stopPropagation();
        }).on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle).on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown).on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown);
    }(jQuery);

    // 清除所有地区选择器
    function clearPickerRegion(e) {
        $('.picker-region-toggle').each(function () {
            var $this = $(this);
            var $parent = $this.parent();
            var relatedTarget = {relatedTarget: this};

            if (!$parent.hasClass('open')) return;

            $parent.trigger(e = $.Event('hide.picker.region', relatedTarget));

            if (e.isDefaultPrevented()) return;

            $parent.removeClass('open').trigger($.Event('hidden.picker.region', relatedTarget));
        });
    }

    $(document)
    // 点击触发器打开地区选择器
        .on('click.picker.region', '.picker-region-toggle', function (e) {
            e.preventDefault();
            var $this = $(this);
            var $parent = $this.parent();
            var isOpen = $parent.hasClass('open');

            clearPickerRegion();

            if (!isOpen) {
                var relatedTarget = {relatedTarget: this};
                $parent.trigger(e = $.Event('show.picker.region', relatedTarget));

                if (e.isDefaultPrevented()) return;

                $parent.addClass('open').trigger($.Event('shown.picker.region', relatedTarget));
            }
        })

        // 点击空白区域关闭地区选择器
        .on('click.picker.region', function (e) {
            var $this = $(e.target);
            var $parent = $this.closest('.picker-region');
            if (!$parent.length) {
                clearPickerRegion();
            }
        })

        // 解决与 dropdown.js 打开冲突
        .on('shown.bs.dropdown', function (e) {
            clearPickerRegion(e);
        });

    var ScrollSpy = function () {
        function ScrollSpy(element, options) {
            classCallCheck(this, ScrollSpy);

            this.$body = $$1(document.body);
            this.$scrollElement = $$1(element).is(document.body) ? $$1(window) : $$1(element);
            this.options = $$1.extend({}, ScrollSpy.DEFAULTS, options);
            this.selector = (this.options.target || '') + ' li > a';
            this.offsets = [];
            this.targets = [];
            this.activeTarget = null;
            this.scrollHeight = 0;

            this.$scrollElement.on('scroll.scrollspy', $$1.proxy(this.process, this));
            this.refresh();
            this.process();
        }

        createClass(ScrollSpy, [{
            key: 'getScrollHeight',
            value: function getScrollHeight() {
                return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight);
            }
        }, {
            key: 'refresh',
            value: function refresh() {
                var that = this;
                var offsetMethod = 'offset';
                var offsetBase = 0;

                this.offsets = [];
                this.targets = [];
                this.scrollHeight = this.getScrollHeight();

                if (!$$1.isWindow(this.$scrollElement[0])) {
                    offsetMethod = 'position';
                    offsetBase = this.$scrollElement.scrollTop();
                }

                this.$body.find(this.selector).map(function () {
                    var $el = $$1(this);
                    var href = $el.data('target') || $el.attr('href');
                    var $href = /^#./.test(href) && $$1(href);

                    return $href && $href.length && $href.is(':visible') && [[$href[offsetMethod]().top + offsetBase, href]] || null;
                }).sort(function (a, b) {
                    return a[0] - b[0];
                }).each(function () {
                    that.offsets.push(this[0]);
                    that.targets.push(this[1]);
                });
            }
        }, {
            key: 'process',
            value: function process() {
                var scrollTop = this.$scrollElement.scrollTop() + this.options.offset;
                var scrollHeight = this.getScrollHeight();
                var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height();
                var offsets = this.offsets;
                var targets = this.targets;
                var activeTarget = this.activeTarget;
                var i = void 0;

                if (this.scrollHeight != scrollHeight) {
                    this.refresh();
                }

                if (scrollTop >= maxScroll) {
                    return activeTarget != (i = targets[targets.length - 1]) && this.activate(i);
                }

                if (activeTarget && scrollTop < offsets[0]) {
                    this.activeTarget = null;
                    return this.clear();
                }

                for (i = offsets.length; i--;) {
                    activeTarget != targets[i] && scrollTop >= offsets[i] && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) && this.activate(targets[i]);
                }
            }
        }, {
            key: 'activate',
            value: function activate(target) {
                this.activeTarget = target;

                this.clear();

                var selector = this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]';

                var active = $$1(selector).parents('li').addClass('active');

                if (active.parent('.dropdown-menu').length) {
                    active = active.closest('li.dropdown').addClass('active');
                }

                active.trigger('activate.bs.scrollspy');
            }
        }, {
            key: 'clear',
            value: function clear() {
                $$1(this.selector).parentsUntil(this.options.target, '.active').removeClass('active');
            }
        }]);
        return ScrollSpy;
    }();

    ScrollSpy.version = '1.0.0';
    ScrollSpy.DEFAULTS = {offset: 10};

    function Plugin$1(option) {
        return this.each(function () {
            var $this = $$1(this);
            var data = $this.data('scrollspy');
            var options = (typeof option === 'undefined' ? 'undefined' : _typeof(option)) == 'object' && option;

            if (!data) $this.data('scrollspy', data = new ScrollSpy(this, options));
            if (typeof option == 'string') data[option]();
        });
    }

    var old$1 = $$1.fn.scrollspy;

    $$1.fn.scrollspy = Plugin$1;
    $$1.fn.scrollspy.Constructor = ScrollSpy;
    $$1.fn.scrollspy.noConflict = function () {
        $$1.fn.scrollspy = old$1;
        return this;
    };

    $$1(window).on('load.scrollspy.data-api', function () {
        $$1('[data-spy="scroll"]').each(function () {
            var $spy = $$1(this);
            Plugin$1.call($spy, $spy.data());
        });
    });

    /* ========================================================================
   * Bootstrap: affix.js v3.3.7
   * http://getbootstrap.com/javascript/#affix
   * ========================================================================
   * Copyright 2011-2016 Twitter, Inc.
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * ======================================================================== */

    +function ($) {

        // AFFIX CLASS DEFINITION
        // ======================

        var Affix = function Affix(element, options) {
            this.options = $.extend({}, Affix.DEFAULTS, options);

            this.$target = $(this.options.target).on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)).on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this));

            this.$element = $(element);
            this.affixed = null;
            this.unpin = null;
            this.pinnedOffset = null;

            this.checkPosition();
        };

        Affix.VERSION = '3.3.7';

        Affix.RESET = 'affix affix-top affix-bottom';

        Affix.DEFAULTS = {
            offset: 0,
            target: window
        };

        Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
            var scrollTop = this.$target.scrollTop();
            var position = this.$element.offset();
            var targetHeight = this.$target.height();

            if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false;

            if (this.affixed == 'bottom') {
                if (offsetTop != null) return scrollTop + this.unpin <= position.top ? false : 'bottom';
                return scrollTop + targetHeight <= scrollHeight - offsetBottom ? false : 'bottom';
            }

            var initializing = this.affixed == null;
            var colliderTop = initializing ? scrollTop : position.top;
            var colliderHeight = initializing ? targetHeight : height;

            if (offsetTop != null && scrollTop <= offsetTop) return 'top';
            if (offsetBottom != null && colliderTop + colliderHeight >= scrollHeight - offsetBottom) return 'bottom';

            return false;
        };

        Affix.prototype.getPinnedOffset = function () {
            if (this.pinnedOffset) return this.pinnedOffset;
            this.$element.removeClass(Affix.RESET).addClass('affix');
            var scrollTop = this.$target.scrollTop();
            var position = this.$element.offset();
            return this.pinnedOffset = position.top - scrollTop;
        };

        Affix.prototype.checkPositionWithEventLoop = function () {
            setTimeout($.proxy(this.checkPosition, this), 1);
        };

        Affix.prototype.checkPosition = function () {
            if (!this.$element.is(':visible')) return;

            var height = this.$element.height();
            var offset = this.options.offset;
            var offsetTop = offset.top;
            var offsetBottom = offset.bottom;
            var scrollHeight = Math.max($(document).height(), $(document.body).height());

            if ((typeof offset === 'undefined' ? 'undefined' : _typeof(offset)) != 'object') offsetBottom = offsetTop = offset;
            if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element);
            if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element);

            var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom);

            if (this.affixed != affix) {
                if (this.unpin != null) this.$element.css('top', '');

                var affixType = 'affix' + (affix ? '-' + affix : '');
                var e = $.Event(affixType + '.bs.affix');

                this.$element.trigger(e);

                if (e.isDefaultPrevented()) return;

                this.affixed = affix;
                this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null;

                this.$element.removeClass(Affix.RESET).addClass(affixType).trigger(affixType.replace('affix', 'affixed') + '.bs.affix');
            }

            if (affix == 'bottom') {
                this.$element.offset({
                    top: scrollHeight - height - offsetBottom
                });
            }
        };

        // AFFIX PLUGIN DEFINITION
        // =======================

        function Plugin(option) {
            return this.each(function () {
                var $this = $(this);
                var data = $this.data('bs.affix');
                var options = (typeof option === 'undefined' ? 'undefined' : _typeof(option)) == 'object' && option;

                if (!data) $this.data('bs.affix', data = new Affix(this, options));
                if (typeof option == 'string') data[option]();
            });
        }

        var old = $.fn.affix;

        $.fn.affix = Plugin;
        $.fn.affix.Constructor = Affix;

        // AFFIX NO CONFLICT
        // =================

        $.fn.affix.noConflict = function () {
            $.fn.affix = old;
            return this;
        };

        // AFFIX DATA-API
        // ==============

        $(window).on('load', function () {
            $('[data-spy="affix"]').each(function () {
                var $spy = $(this);
                var data = $spy.data();

                data.offset = data.offset || {};

                if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom;
                if (data.offsetTop != null) data.offset.top = data.offsetTop;

                Plugin.call($spy, data);
            });
        });
    }(jQuery);

    // 清除分厅选择器
    function clearHeaderHall(e) {
        $('.navigation-hall-toggle').each(function () {
            var $this = $(this);
            var $parent = $this.parent();
            var relatedTarget = {relatedTarget: this};

            if (!$parent.hasClass('open')) return;

            $parent.trigger(e = $.Event('hide.header.hall', relatedTarget));

            if (e.isDefaultPrevented()) return;

            $parent.removeClass('open').trigger($.Event('hidden.header.hall', relatedTarget));
        });
    }

    $(document)
    // 下拉菜单展开收起
        .on('click.header.hall', '.navigation-hall .navigation-hall-toggle', function (e) {
            e.preventDefault();
            var $this = $(this);
            var $this = $(this);
            var $parent = $this.parent();
            var isOpen = $parent.hasClass('open');

            clearHeaderHall();

            if (!isOpen) {
                var relatedTarget = {relatedTarget: this};
                $parent.trigger(e = $.Event('show.header.hall', relatedTarget));

                if (e.isDefaultPrevented()) return;

                $parent.addClass('open').trigger($.Event('shown.header.hall', relatedTarget));
            }
        })

        // 点击非下拉菜单区隐藏下拉菜单
        .on('click.header.hall', function (e) {
            var $this = $(e.target);
            var $parent = $this.closest('.navigation-hall');
            if (!$parent.length) {
                clearHeaderHall();
            }
        })

        // 解决与 dropdown.js 打开冲突
        .on('shown.bs.dropdown', function (e) {
            clearHeaderHall();
        });

    function getLocalSearches() {
        var searches = localStorage && localStorage.getItem('gdbs.searches');
        return searches ? JSON.parse(searches) : [];
    }

    function setLocalSearches(searches) {
        localStorage && localStorage.setItem('gdbs.searches', JSON.stringify(searches));
    }

    function updateSuggest() {
        var $suggest = $('.hero-search-suggest');
        var searches = getLocalSearches();
        if ($suggest.length > 0 && searches.length > 0) {
            var suggestItem = searches.map(function (item) {
                var itemText = $('<div />').text(item).html();
                return '<a class="hero-search-suggest-item" href="javascript:;">' + itemText + '</a>';
            });
            $suggest.html('<span class="hero-search-suggest-title">最近搜索：</span>' + suggestItem.join(''));
        }
    }

    updateSuggest();

    $(document).on('submit', '.search-form', function () {
        var $form = $(this);
        var $input = $form.find('.search-form-input');
        var keyword = $input.val();
        if (keyword) {
            var searches = getLocalSearches();
            searches.unshift(keyword);
            searches = $.unique(searches);
            setLocalSearches(searches.splice(0, 5));
            updateSuggest();
        }
    });

    $(document).on('submit', '.header-search', function () {
        var $form = $(this);
        var $input = $form.find('.header-search-input');
        var keyword = $input.val();
        if (keyword) {
            var searches = getLocalSearches();
            searches.unshift(keyword);
            searches = $.unique(searches);
            setLocalSearches(searches.splice(0, 5));
            updateSuggest();
        }
    });

    /*通用弹框*/
    (function (window, $) {

        //add by bjca begin
        $('#alert').remove();
        $('#confirm').remove();
        $('#modal').remove();
        $('#dialog').remove();
        $('#toast').remove();
        $('#mask').remove();
        //add by bjca end

        //初始化html
        var html = '<div id="alert"  aria-label="消息提示框"><div class="box"><h2 class="head"></h2><p class="msg"></p><p><a class="btn btn-ok btn-primary">\u6211\u77E5\u9053\u4E86</a></p></div></div>\n<div id="confirm"  aria-label="确认对话框"><div class="box"><h2 class="head"></h2><p class="msg"></p><p><a class="btn btn-ok btn-primary">\u786E\u8BA4</a><a class="btn btn-cancel btn-default">\u53D6\u6D88</a></p></div></div>\n<div id="modal" aria-label="模态对话框"><div class="box"><iframe frameborder="0"></iframe><a class="btn-close"></a></div></div>\n<div id="dialog"><div class="box"><a class="btn-close"></a></div><div class="tempbox"></div></div>\n<div id="toast"></div>';
        $(document.body).append(html);

        //alert方法
        var alert = window.alert = function () {
            var $alert = $('#alert'),
                $head = $alert.find('.head'),
                $msg = $alert.find('.msg'),
                opts;

            //确定按钮点击
            $alert.on('click', '.btn-ok', function () {
                var btnOkClick = opts.btnOkClick;
                typeof btnOkClick === 'function' && btnOkClick();

                //关闭窗口
                $alert.removeClass('visible');
            });

            return function (options) {
                //配置项
                (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' && (options = {msg: options});
                opts = $.extend({}, alert.defaults, options);

                //显示内容
                $head.html(opts.head || '');
                $msg.html(opts.msg);

                //打开窗口
                $alert.addClass('visible');
            };
        }();
        alert.defaults = {
            msg: '内容',
            head: ''
        };

        //confirm方法
        var confirm = window.confirm = function () {
            var $confirm = $('#confirm'),
                $head = $confirm.find('.head'),
                $msg = $confirm.find('.msg'),
                opts;

            //确定和取消按钮点击
            $confirm.on('click', '.btn-ok', function () {
                var btnOkClick = opts.btnOkClick;
                typeof btnOkClick === 'function' && btnOkClick();

                //关闭窗口
                $confirm.removeClass('visible');
            }).on('click', '.btn-cancel', function () {
                var btnCancelClick = opts.btnCancelClick;
                typeof btnCancelClick === 'function' && btnCancelClick();

                //关闭窗口
                $confirm.removeClass('visible');
            });

            return function (options) {
                //配置项
                (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' && (options = {msg: options});
                //配置项
                opts = $.extend({}, confirm.defaults, options);

                //设置内容
                $head.html(opts.head || '');
                $msg.html(opts.msg);

                //打开窗口
                $confirm.addClass('visible');
            };
        }();
        confirm.defaults = {
            msg: '内容',
            head: ''
        };

        //modal方法
        var modal = window.modal = function () {
            var $modal = $('#modal'),
                $box = $modal.find('.box'),
                $iframe = $modal.find('iframe'),
                htmlEl = document.documentElement,
                opts;

            //关闭按钮点击
            $modal.on('click', '.btn-close', function () {
                modal.close();
            });

            return function (options) {
                //配置项
                (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' && (options = {href: options});
                opts = $.extend({}, modal.defaults, options);

                //高度限定不超过窗口高度
                var wHeight = htmlEl.clientHeight;
                opts.height > wHeight && (opts.height = wHeight);

                //设置页面
                $iframe.attr({
                    width: opts.width,
                    height: opts.height,
                    src: opts.href
                });

                //设置位置尺寸
                $box.css({
                    'margin-left': -opts.width / 2 + 'px',
                    'margin-top': -opts.height / 2 + 'px'
                });

                //打开窗口
                $modal.addClass('visible');

                //关闭函数
                modal.close = function () {
                    var onClose = opts.onClose;
                    typeof onClose === 'function' && onClose();

                    //关闭窗口
                    $modal.removeClass('visible');

                    //重置页面
                    setTimeout(function () {
                        $iframe.attr('src', '');
                    }, parseFloat($modal.css('transition-duration')) * 1000);
                };
            };
        }();
        modal.defaults = {
            width: 980,
            height: 640
        };

        //dialog方法
        var dialog = window.dialog = function () {
            var $dialog = $('#dialog'),
                $box = $dialog.find('.box'),
                $tempbox = $dialog.find('.tempbox'),
                htmlEl = document.documentElement,
                opts,
                elCache = {};

            //关闭按钮点击
            $dialog.on('click', '.btn-close', function () {
                dialog.close();
            });

            return function (options) {
                //配置项
                (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' && (options = {sel: options});
                opts = $.extend({}, dialog.defaults, options);

                //显示的元素
                var sel = opts.sel,
                    $el = elCache[sel] || (elCache[sel] = $(sel)),
                    width = $el[0].offsetWidth,
                    height = $el[0].offsetHeight;

                //高度限定不超过窗口高度
                var wHeight = htmlEl.clientHeight;
                height > wHeight && (height = wHeight);

                //设置位置尺寸
                $box.css({
                    width: width + 'px',
                    height: height + 'px',
                    'margin-left': -width / 2 + 'px',
                    'margin-top': -height / 2 + 'px'
                }).append($el);

                //打开窗口
                $dialog.addClass('visible');

                //关闭函数
                dialog.close = function () {
                    var onClose = opts.onClose;
                    typeof onClose === 'function' && onClose();

                    //关闭窗口
                    $dialog.removeClass('visible');

                    //重置内容
                    setTimeout(function () {
                        $el.appendTo($tempbox);
                    }, parseFloat($dialog.css('transition-duration')) * 1000);
                };
            };
        }();
        dialog.defaults = {};

        //toast方法
        window.toast = function () {
            var $toast = $('#toast'),
                timeout;

            return function (msg, isOk, time) {
                $toast.html(msg).addClass('visible');

                //ok状态
                isOk ? $toast.addClass('ok') : $toast.removeClass('ok');

                //定时隐藏
                clearTimeout(timeout);
                timeout = setTimeout(function () {
                    $toast.removeClass('visible');
                }, time || 2000);
            };
        }();
    })(window, $);

    /* ========================================================================
   * Bootstrap: tooltip.js v3.3.7
   * http://getbootstrap.com/javascript/#tooltip
   * Inspired by the original jQuery.tipsy by Jason Frame
   * ========================================================================
   * Copyright 2011-2016 Twitter, Inc.
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * ======================================================================== */

    +function ($) {

        // TOOLTIP PUBLIC CLASS DEFINITION
        // ===============================

        var Tooltip = function Tooltip(element, options) {
            this.type = null;
            this.options = null;
            this.enabled = null;
            this.timeout = null;
            this.hoverState = null;
            this.$element = null;
            this.inState = null;

            this.init('tooltip', element, options);
        };

        Tooltip.VERSION = '3.3.7';

        Tooltip.TRANSITION_DURATION = 150;

        Tooltip.DEFAULTS = {
            animation: true,
            placement: 'top',
            selector: false,
            template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
            trigger: 'hover focus',
            title: '',
            delay: 0,
            html: false,
            // container: false,
            container: 'body',
            viewport: {
                selector: 'body',
                padding: 0
            }
        };

        Tooltip.prototype.init = function (type, element, options) {
            this.enabled = true;
            this.type = type;
            this.$element = $(element);
            this.options = this.getOptions(options);
            this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : this.options.viewport.selector || this.options.viewport);
            this.inState = {click: false, hover: false, focus: false};

            if (this.$element[0] instanceof document.constructor && !this.options.selector) {
                throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!');
            }

            var triggers = this.options.trigger.split(' ');

            for (var i = triggers.length; i--;) {
                var trigger = triggers[i];

                if (trigger == 'click') {
                    this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this));
                } else if (trigger != 'manual') {
                    var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin';
                    var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout';

                    this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this));
                    this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this));
                }
            }

            this.options.selector ? this._options = $.extend({}, this.options, {
                trigger: 'manual',
                selector: ''
            }) : this.fixTitle();
        };

        Tooltip.prototype.getDefaults = function () {
            return Tooltip.DEFAULTS;
        };

        Tooltip.prototype.getOptions = function (options) {
            options = $.extend({}, this.getDefaults(), this.$element.data(), options);

            if (options.delay && typeof options.delay == 'number') {
                options.delay = {
                    show: options.delay,
                    hide: options.delay
                };
            }

            return options;
        };

        Tooltip.prototype.getDelegateOptions = function () {
            var options = {};
            var defaults$$1 = this.getDefaults();

            this._options && $.each(this._options, function (key, value) {
                if (defaults$$1[key] != value) options[key] = value;
            });

            return options;
        };

        Tooltip.prototype.enter = function (obj) {
            var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type);

            if (!self) {
                self = new this.constructor(obj.currentTarget, this.getDelegateOptions());
                $(obj.currentTarget).data('bs.' + this.type, self);
            }

            if (obj instanceof $.Event) {
                self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true;
            }

            if (self.tip().hasClass('in') || self.hoverState == 'in') {
                self.hoverState = 'in';
                return;
            }

            clearTimeout(self.timeout);

            self.hoverState = 'in';

            if (!self.options.delay || !self.options.delay.show) return self.show();

            self.timeout = setTimeout(function () {
                if (self.hoverState == 'in') self.show();
            }, self.options.delay.show);
        };

        Tooltip.prototype.isInStateTrue = function () {
            for (var key in this.inState) {
                if (this.inState[key]) return true;
            }

            return false;
        };

        Tooltip.prototype.leave = function (obj) {
            var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type);

            if (!self) {
                self = new this.constructor(obj.currentTarget, this.getDelegateOptions());
                $(obj.currentTarget).data('bs.' + this.type, self);
            }

            if (obj instanceof $.Event) {
                self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false;
            }

            if (self.isInStateTrue()) return;

            clearTimeout(self.timeout);

            self.hoverState = 'out';

            if (!self.options.delay || !self.options.delay.hide) return self.hide();

            self.timeout = setTimeout(function () {
                if (self.hoverState == 'out') self.hide();
            }, self.options.delay.hide);
        };

        Tooltip.prototype.show = function () {
            var e = $.Event('show.bs.' + this.type);

            if (this.hasContent() && this.enabled) {
                this.$element.trigger(e);

                var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]);
                if (e.isDefaultPrevented() || !inDom) return;
                var that = this;

                var $tip = this.tip();

                var tipId = this.getUID(this.type);

                this.setContent();
                $tip.attr('id', tipId);
                this.$element.attr('aria-describedby', tipId);

                if (this.options.animation) $tip.addClass('fade');

                var placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement;

                var autoToken = /\s?auto?\s?/i;
                var autoPlace = autoToken.test(placement);
                if (autoPlace) placement = placement.replace(autoToken, '') || 'top';

                $tip.detach().css({
                    top: 0,
                    left: 0,
                    display: 'block'
                }).addClass(placement).data('bs.' + this.type, this);

                this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element);
                this.$element.trigger('inserted.bs.' + this.type);

                var pos = this.getPosition();
                var actualWidth = $tip[0].offsetWidth;
                var actualHeight = $tip[0].offsetHeight;

                if (autoPlace) {
                    var orgPlacement = placement;
                    var viewportDim = this.getPosition(this.$viewport);

                    placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : placement;

                    $tip.removeClass(orgPlacement).addClass(placement);
                }

                var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);

                this.applyPlacement(calculatedOffset, placement);

                var complete = function complete() {
                    var prevHoverState = that.hoverState;
                    that.$element.trigger('shown.bs.' + that.type);
                    that.hoverState = null;

                    if (prevHoverState == 'out') that.leave(that);
                };

                $.support.transition && this.$tip.hasClass('fade') ? $tip.one('bsTransitionEnd', complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete();
            }
        };

        Tooltip.prototype.applyPlacement = function (offset, placement) {
            var $tip = this.tip();
            var width = $tip[0].offsetWidth;
            var height = $tip[0].offsetHeight;

            // manually read margins because getBoundingClientRect includes difference
            var marginTop = parseInt($tip.css('margin-top'), 10);
            var marginLeft = parseInt($tip.css('margin-left'), 10);

            // we must check for NaN for ie 8/9
            if (isNaN(marginTop)) marginTop = 0;
            if (isNaN(marginLeft)) marginLeft = 0;

            offset.top += marginTop;
            offset.left += marginLeft;

            // $.fn.offset doesn't round pixel values
            // so we use setOffset directly with our own function B-0
            $.offset.setOffset($tip[0], $.extend({
                using: function using(props) {
                    $tip.css({
                        top: Math.round(props.top),
                        left: Math.round(props.left)
                    });
                }
            }, offset), 0);

            $tip.addClass('in');

            // check to see if placing tip in new offset caused the tip to resize itself
            var actualWidth = $tip[0].offsetWidth;
            var actualHeight = $tip[0].offsetHeight;

            if (placement == 'top' && actualHeight != height) {
                offset.top = offset.top + height - actualHeight;
            }

            var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight);

            if (delta.left) offset.left += delta.left; else offset.top += delta.top;

            var isVertical = /top|bottom/.test(placement);
            var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight;
            var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight';

            $tip.offset(offset);
            this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical);
        };

        Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
            this.arrow().css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%').css(isVertical ? 'top' : 'left', '');
        };

        Tooltip.prototype.setContent = function () {
            var $tip = this.tip();
            var title = this.getTitle();

            $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title);
            $tip.removeClass('fade in top bottom left right');
        };

        Tooltip.prototype.hide = function (callback) {
            var that = this;
            var $tip = $(this.$tip);
            var e = $.Event('hide.bs.' + this.type);

            function complete() {
                if (that.hoverState != 'in') $tip.detach();
                if (that.$element) {
                    // TODO: Check whether guarding this code with this `if` is really necessary.
                    that.$element.removeAttr('aria-describedby').trigger('hidden.bs.' + that.type);
                }
                callback && callback();
            }

            this.$element.trigger(e);

            if (e.isDefaultPrevented()) return;

            $tip.removeClass('in');

            $.support.transition && $tip.hasClass('fade') ? $tip.one('bsTransitionEnd', complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete();

            this.hoverState = null;

            return this;
        };

        Tooltip.prototype.fixTitle = function () {
            var $e = this.$element;
            if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
                $e.attr('data-original-title', $e.attr('title') || '').attr('title', '');
            }
        };

        Tooltip.prototype.hasContent = function () {
            return this.getTitle();
        };

        Tooltip.prototype.getPosition = function ($element) {
            $element = $element || this.$element;

            var el = $element[0];
            var isBody = el.tagName == 'BODY';

            var elRect = el.getBoundingClientRect();
            if (elRect.width == null) {
                // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
                elRect = $.extend({}, elRect, {width: elRect.right - elRect.left, height: elRect.bottom - elRect.top});
            }
            var isSvg = window.SVGElement && el instanceof window.SVGElement;
            // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
            // See https://github.com/twbs/bootstrap/issues/20280
            var elOffset = isBody ? {top: 0, left: 0} : isSvg ? null : $element.offset();
            var scroll = {scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop()};
            var outerDims = isBody ? {width: $(window).width(), height: $(window).height()} : null;

            return $.extend({}, elRect, scroll, outerDims, elOffset);
        };

        Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
            return placement == 'bottom' ? {
                top: pos.top + pos.height,
                left: pos.left + pos.width / 2 - actualWidth / 2
            } : placement == 'top' ? {
                top: pos.top - actualHeight,
                left: pos.left + pos.width / 2 - actualWidth / 2
            } : placement == 'left' ? {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} :
                /* placement == 'right' */{
                    top: pos.top + pos.height / 2 - actualHeight / 2,
                    left: pos.left + pos.width
                };
        };

        Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
            var delta = {top: 0, left: 0};
            if (!this.$viewport) return delta;

            var viewportPadding = this.options.viewport && this.options.viewport.padding || 0;
            var viewportDimensions = this.getPosition(this.$viewport);

            if (/right|left/.test(placement)) {
                var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll;
                var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight;
                if (topEdgeOffset < viewportDimensions.top) {
                    // top overflow
                    delta.top = viewportDimensions.top - topEdgeOffset;
                } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) {
                    // bottom overflow
                    delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset;
                }
            } else {
                var leftEdgeOffset = pos.left - viewportPadding;
                var rightEdgeOffset = pos.left + viewportPadding + actualWidth;
                if (leftEdgeOffset < viewportDimensions.left) {
                    // left overflow
                    delta.left = viewportDimensions.left - leftEdgeOffset;
                } else if (rightEdgeOffset > viewportDimensions.right) {
                    // right overflow
                    delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset;
                }
            }

            return delta;
        };

        Tooltip.prototype.getTitle = function () {
            var title;
            var $e = this.$element;
            var o = this.options;

            title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title);

            return title;
        };

        Tooltip.prototype.getUID = function (prefix) {
            do {
                prefix += ~~(Math.random() * 1000000);
            } while (document.getElementById(prefix));
            return prefix;
        };

        Tooltip.prototype.tip = function () {
            if (!this.$tip) {
                this.$tip = $(this.options.template);
                if (this.$tip.length != 1) {
                    throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!');
                }
            }
            return this.$tip;
        };

        Tooltip.prototype.arrow = function () {
            return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow');
        };

        Tooltip.prototype.enable = function () {
            this.enabled = true;
        };

        Tooltip.prototype.disable = function () {
            this.enabled = false;
        };

        Tooltip.prototype.toggleEnabled = function () {
            this.enabled = !this.enabled;
        };

        Tooltip.prototype.toggle = function (e) {
            var self = this;
            if (e) {
                self = $(e.currentTarget).data('bs.' + this.type);
                if (!self) {
                    self = new this.constructor(e.currentTarget, this.getDelegateOptions());
                    $(e.currentTarget).data('bs.' + this.type, self);
                }
            }

            if (e) {
                self.inState.click = !self.inState.click;
                if (self.isInStateTrue()) self.enter(self); else self.leave(self);
            } else {
                self.tip().hasClass('in') ? self.leave(self) : self.enter(self);
            }
        };

        Tooltip.prototype.destroy = function () {
            var that = this;
            clearTimeout(this.timeout);
            this.hide(function () {
                that.$element.off('.' + that.type).removeData('bs.' + that.type);
                if (that.$tip) {
                    that.$tip.detach();
                }
                that.$tip = null;
                that.$arrow = null;
                that.$viewport = null;
                that.$element = null;
            });
        };

        // TOOLTIP PLUGIN DEFINITION
        // =========================

        function Plugin(option) {
            return this.each(function () {
                var $this = $(this);
                var data = $this.data('bs.tooltip');
                var options = (typeof option === 'undefined' ? 'undefined' : _typeof(option)) == 'object' && option;

                if (!data && /destroy|hide/.test(option)) return;
                if (!data) $this.data('bs.tooltip', data = new Tooltip(this, options));
                if (typeof option == 'string') data[option]();
            });
        }

        var old = $.fn.tooltip;

        $.fn.tooltip = Plugin;
        $.fn.tooltip.Constructor = Tooltip;

        // TOOLTIP NO CONFLICT
        // ===================

        $.fn.tooltip.noConflict = function () {
            $.fn.tooltip = old;
            return this;
        };

        $('[data-toggle="tooltip"]').tooltip();
    }(jQuery);

    /* ========================================================================
   * Bootstrap: popover.js v3.3.7
   * http://getbootstrap.com/javascript/#popovers
   * ========================================================================
   * Copyright 2011-2016 Twitter, Inc.
   * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
   * ======================================================================== */

    +function ($) {

        // POPOVER PUBLIC CLASS DEFINITION
        // ===============================

        var Popover = function Popover(element, options) {
            this.init('popover', element, options);
        };

        if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js');

        Popover.VERSION = '3.3.7';

        Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
            placement: 'right',
            trigger: 'click',
            content: '',
            template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
        });

        // NOTE: POPOVER EXTENDS tooltip.js
        // ================================

        Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype);

        Popover.prototype.constructor = Popover;

        Popover.prototype.getDefaults = function () {
            return Popover.DEFAULTS;
        };

        Popover.prototype.setContent = function () {
            var $tip = this.tip();
            var title = this.getTitle();
            var content = this.getContent();

            $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title);
            $tip.find('.popover-content').children().detach().end()[// we use append for html objects to maintain js events
                this.options.html ? typeof content == 'string' ? 'html' : 'append' : 'text'](content);

            $tip.removeClass('fade top bottom left right in');

            // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
            // this manually by checking the contents.
            if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();
        };

        Popover.prototype.hasContent = function () {
            return this.getTitle() || this.getContent();
        };

        Popover.prototype.getContent = function () {
            var $e = this.$element;
            var o = this.options;

            return $e.attr('data-content') || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content);
        };

        Popover.prototype.arrow = function () {
            return this.$arrow = this.$arrow || this.tip().find('.arrow');
        };

        // POPOVER PLUGIN DEFINITION
        // =========================

        function Plugin(option) {
            return this.each(function () {
                var $this = $(this);
                var data = $this.data('bs.popover');
                var options = (typeof option === 'undefined' ? 'undefined' : _typeof(option)) == 'object' && option;

                if (!data && /destroy|hide/.test(option)) return;
                if (!data) $this.data('bs.popover', data = new Popover(this, options));
                if (typeof option == 'string') data[option]();
            });
        }

        var old = $.fn.popover;

        $.fn.popover = Plugin;
        $.fn.popover.Constructor = Popover;

        // POPOVER NO CONFLICT
        // ===================

        $.fn.popover.noConflict = function () {
            $.fn.popover = old;
            return this;
        };

        $('body').popover({
            selector: '[data-toggle="popover"]',
            trigger: 'hover'
        });
    }(jQuery);

    $(document).on('click', '.select-tab-collapse-toggle-link', function () {
        var $this = $(this);
        var $selectTab = $this.parent().prev();
        var isCollapse = $selectTab.hasClass('select-tab-collapse');
        if (isCollapse) {
            $this.html('收起 <i class="icon icon-up"></i>');
            $selectTab.removeClass('select-tab-collapse');
        } else {
            $this.html('全部展开 <i class="icon icon-down"></i>');
            $selectTab.addClass('select-tab-collapse');
        }
    });

    /**
     * @author zhixin wen <wenzhixin2010@gmail.com>
     * @version 1.2.1
     *
     * http://wenzhixin.net.cn/p/multiple-select/
     */

    (function ($) {

        // it only does '%s', and return '' when arguments are undefined

        var sprintf = function sprintf(str) {
            var args = arguments,
                flag = true,
                i = 1;

            str = str.replace(/%s/g, function () {
                var arg = args[i++];

                if (typeof arg === 'undefined') {
                    flag = false;
                    return '';
                }
                return arg;
            });
            return flag ? str : '';
        };

        var removeDiacritics = function removeDiacritics(str) {
            var defaultDiacriticsRemovalMap = [{
                'base': 'A',
                'letters': /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
            }, {'base': 'AA', 'letters': /[\uA732]/g}, {
                'base': 'AE',
                'letters': /[\u00C6\u01FC\u01E2]/g
            }, {'base': 'AO', 'letters': /[\uA734]/g}, {'base': 'AU', 'letters': /[\uA736]/g}, {
                'base': 'AV',
                'letters': /[\uA738\uA73A]/g
            }, {'base': 'AY', 'letters': /[\uA73C]/g}, {
                'base': 'B',
                'letters': /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
            }, {
                'base': 'C',
                'letters': /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
            }, {
                'base': 'D',
                'letters': /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
            }, {'base': 'DZ', 'letters': /[\u01F1\u01C4]/g}, {'base': 'Dz', 'letters': /[\u01F2\u01C5]/g}, {
                'base': 'E',
                'letters': /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
            }, {'base': 'F', 'letters': /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g}, {
                'base': 'G',
                'letters': /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
            }, {
                'base': 'H',
                'letters': /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
            }, {
                'base': 'I',
                'letters': /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
            }, {'base': 'J', 'letters': /[\u004A\u24BF\uFF2A\u0134\u0248]/g}, {
                'base': 'K',
                'letters': /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
            }, {
                'base': 'L',
                'letters': /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
            }, {'base': 'LJ', 'letters': /[\u01C7]/g}, {'base': 'Lj', 'letters': /[\u01C8]/g}, {
                'base': 'M',
                'letters': /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g
            }, {
                'base': 'N',
                'letters': /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
            }, {'base': 'NJ', 'letters': /[\u01CA]/g}, {'base': 'Nj', 'letters': /[\u01CB]/g}, {
                'base': 'O',
                'letters': /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g
            }, {'base': 'OI', 'letters': /[\u01A2]/g}, {'base': 'OO', 'letters': /[\uA74E]/g}, {
                'base': 'OU',
                'letters': /[\u0222]/g
            }, {
                'base': 'P',
                'letters': /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
            }, {'base': 'Q', 'letters': /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g}, {
                'base': 'R',
                'letters': /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
            }, {
                'base': 'S',
                'letters': /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
            }, {
                'base': 'T',
                'letters': /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
            }, {'base': 'TZ', 'letters': /[\uA728]/g}, {
                'base': 'U',
                'letters': /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g
            }, {'base': 'V', 'letters': /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g}, {
                'base': 'VY',
                'letters': /[\uA760]/g
            }, {
                'base': 'W',
                'letters': /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
            }, {'base': 'X', 'letters': /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g}, {
                'base': 'Y',
                'letters': /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
            }, {
                'base': 'Z',
                'letters': /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
            }, {
                'base': 'a',
                'letters': /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g
            }, {'base': 'aa', 'letters': /[\uA733]/g}, {
                'base': 'ae',
                'letters': /[\u00E6\u01FD\u01E3]/g
            }, {'base': 'ao', 'letters': /[\uA735]/g}, {'base': 'au', 'letters': /[\uA737]/g}, {
                'base': 'av',
                'letters': /[\uA739\uA73B]/g
            }, {'base': 'ay', 'letters': /[\uA73D]/g}, {
                'base': 'b',
                'letters': /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
            }, {
                'base': 'c',
                'letters': /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
            }, {
                'base': 'd',
                'letters': /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
            }, {'base': 'dz', 'letters': /[\u01F3\u01C6]/g}, {
                'base': 'e',
                'letters': /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g
            }, {'base': 'f', 'letters': /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g}, {
                'base': 'g',
                'letters': /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
            }, {
                'base': 'h',
                'letters': /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
            }, {'base': 'hv', 'letters': /[\u0195]/g}, {
                'base': 'i',
                'letters': /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
            }, {'base': 'j', 'letters': /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g}, {
                'base': 'k',
                'letters': /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
            }, {
                'base': 'l',
                'letters': /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
            }, {'base': 'lj', 'letters': /[\u01C9]/g}, {
                'base': 'm',
                'letters': /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g
            }, {
                'base': 'n',
                'letters': /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
            }, {'base': 'nj', 'letters': /[\u01CC]/g}, {
                'base': 'o',
                'letters': /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g
            }, {'base': 'oi', 'letters': /[\u01A3]/g}, {'base': 'ou', 'letters': /[\u0223]/g}, {
                'base': 'oo',
                'letters': /[\uA74F]/g
            }, {
                'base': 'p',
                'letters': /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
            }, {'base': 'q', 'letters': /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g}, {
                'base': 'r',
                'letters': /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
            }, {
                'base': 's',
                'letters': /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
            }, {
                'base': 't',
                'letters': /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
            }, {'base': 'tz', 'letters': /[\uA729]/g}, {
                'base': 'u',
                'letters': /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g
            }, {'base': 'v', 'letters': /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g}, {
                'base': 'vy',
                'letters': /[\uA761]/g
            }, {
                'base': 'w',
                'letters': /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
            }, {'base': 'x', 'letters': /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g}, {
                'base': 'y',
                'letters': /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
            }, {
                'base': 'z',
                'letters': /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
            }];

            for (var i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
                str = str.replace(defaultDiacriticsRemovalMap[i].letters, defaultDiacriticsRemovalMap[i].base);
            }

            return str;
        };

        function MultipleSelect($el, options) {
            var that = this,
                name = $el.attr('name') || options.name || '';

            this.options = options;

            // hide select element
            this.$el = $el.hide();

            // label element
            this.$label = this.$el.closest('label');
            if (this.$label.length === 0 && this.$el.attr('id')) {
                this.$label = $(sprintf('label[for="%s"]', this.$el.attr('id').replace(/:/g, '\\:')));
            }

            // restore class and title from select element
            this.$parent = $(sprintf('<div class="ms-parent %s" %s/>', $el.attr('class') || '', sprintf('title="%s"', $el.attr('title'))));

            // add placeholder to choice button
            this.$choice = $(sprintf(['<button type="button" class="ms-choice">', '<span class="placeholder">%s</span>', '<i class="icon icon-downarrow"></i>', '</button>'].join(''), this.options.placeholder));

            // default position is bottom
            this.$drop = $(sprintf('<div class="ms-drop %s"%s></div>', this.options.position, sprintf(' style="width: %s"', this.options.dropWidth)));

            this.$el.after(this.$parent);
            this.$parent.append(this.$choice);
            this.$parent.append(this.$drop);

            if (this.$el.prop('disabled')) {
                this.$choice.addClass('disabled');
            }
            this.$parent.css('width', this.options.width || this.$el.css('width') || this.$el.outerWidth() + 20);

            this.selectAllName = 'data-name="selectAll' + name + '"';
            this.selectGroupName = 'data-name="selectGroup' + name + '"';
            this.selectItemName = 'data-name="selectItem' + name + '"';

            if (!this.options.keepOpen) {
                $(document).click(function (e) {
                    if ($(e.target)[0] === that.$choice[0] || $(e.target).parents('.ms-choice')[0] === that.$choice[0]) {
                        return;
                    }
                    if (($(e.target)[0] === that.$drop[0] || $(e.target).parents('.ms-drop')[0] !== that.$drop[0] && e.target !== $el[0]) && that.options.isOpen) {
                        that.close();
                    }
                });
            }
        }

        MultipleSelect.prototype = {
            constructor: MultipleSelect,

            init: function init() {
                var that = this,
                    $ul = $('<ul></ul>');

                this.$drop.html('');

                if (this.options.filter) {
                    this.$drop.append(['<div class="ms-search">', '<input type="text" autocomplete="off" autocorrect="off" autocapitilize="off" spellcheck="false">', '</div>'].join(''));
                }

                if (this.options.selectAll && !this.options.single) {
                    $ul.append(['<li class="ms-select-all">', '<label class="form-checkbox-wrapper">', sprintf('<input type="checkbox" %s /> ', this.selectAllName), '<span>', this.options.selectAllText, '</span>', '</label>', '</li>'].join(''));
                }

                $.each(this.$el.children(), function (i, elm) {
                    $ul.append(that.optionToHtml(i, elm));
                });
                $ul.append(sprintf('<li class="ms-no-results">%s</li>', this.options.noMatchesFound));
                this.$drop.append($ul);

                this.$drop.find('ul').css('max-height', this.options.maxHeight + 'px');
                this.$drop.find('.multiple').css('width', this.options.multipleWidth + 'px');

                this.$searchInput = this.$drop.find('.ms-search input');
                this.$selectAll = this.$drop.find('input[' + this.selectAllName + ']');
                this.$selectGroups = this.$drop.find('input[' + this.selectGroupName + ']');
                this.$selectItems = this.$drop.find('input[' + this.selectItemName + ']:enabled');
                this.$disableItems = this.$drop.find('input[' + this.selectItemName + ']:disabled');
                this.$noResults = this.$drop.find('.ms-no-results');

                this.events();
                this.updateSelectAll(true);
                this.update(true);

                if (this.options.isOpen) {
                    this.open();
                }
            },

            optionToHtml: function optionToHtml(i, elm, group, groupDisabled) {
                var that = this,
                    $elm = $(elm),
                    classes = $elm.attr('class') || '',
                    title = sprintf('title="%s"', $elm.attr('title')),
                    multiple = this.options.multiple ? 'multiple' : '',
                    disabled,
                    type = this.options.single ? 'radio' : 'checkbox';

                if ($elm.is('option')) {
                    var value = $elm.val(),
                        text = that.options.textTemplate($elm),
                        selected = $elm.prop('selected'),
                        style = sprintf('style="%s"', this.options.styler(value)),
                        $el;

                    disabled = groupDisabled || $elm.prop('disabled');

                    $el = $([sprintf('<li class="%s %s" %s %s>', multiple, classes, title, style), sprintf('<label class="%s form-checkbox-wrapper">', disabled ? 'disabled' : ''), sprintf('<input type="%s" %s%s%s%s>', type, this.selectItemName, selected ? ' checked="checked"' : '', disabled ? ' disabled="disabled"' : '', sprintf(' data-group="%s"', group)), sprintf('<span>%s</span>', text), '</label>', '</li>'].join(''));
                    $el.find('input').val(value);
                    return $el;
                }
                if ($elm.is('optgroup')) {
                    var label = that.options.labelTemplate($elm),
                        $group = $('<div/>');

                    group = 'group_' + i;
                    disabled = $elm.prop('disabled');

                    $group.append(['<li class="group">', sprintf('<label class="optgroup %s" data-group="%s">', disabled ? 'disabled' : '', group), this.options.hideOptgroupCheckboxes || this.options.single ? '' : sprintf('<input type="checkbox" %s %s>', this.selectGroupName, disabled ? 'disabled="disabled"' : ''), label, '</label>', '</li>'].join(''));

                    $.each($elm.children(), function (i, elm) {
                        $group.append(that.optionToHtml(i, elm, group, disabled));
                    });
                    return $group.html();
                }
            },

            events: function events() {
                var that = this,
                    toggleOpen = function toggleOpen(e) {
                        e.preventDefault();
                        that[that.options.isOpen ? 'close' : 'open']();
                    };

                if (this.$label) {
                    this.$label.off('click').on('click', function (e) {
                        if (e.target.nodeName.toLowerCase() !== 'label' || e.target !== this) {
                            return;
                        }
                        toggleOpen(e);
                        if (!that.options.filter || !that.options.isOpen) {
                            that.focus();
                        }
                        e.stopPropagation(); // Causes lost focus otherwise
                    });
                }

                this.$choice.off('click').on('click', toggleOpen).off('focus').on('focus', this.options.onFocus).off('blur').on('blur', this.options.onBlur);

                this.$parent.off('keydown').on('keydown', function (e) {
                    switch (e.which) {
                        case 27:
                            // esc key
                            that.close();
                            that.$choice.focus();
                            break;
                    }
                });

                this.$searchInput.off('keydown').on('keydown', function (e) {
                    // Ensure shift-tab causes lost focus from filter as with clicking away
                    if (e.keyCode === 9 && e.shiftKey) {
                        that.close();
                    }
                }).off('keyup').on('keyup', function (e) {
                    // enter or space
                    // Avoid selecting/deselecting if no choices made
                    if (that.options.filterAcceptOnEnter && (e.which === 13 || e.which == 32) && that.$searchInput.val()) {
                        that.$selectAll.click();
                        that.close();
                        that.focus();
                        return;
                    }
                    that.filter();
                });

                this.$selectAll.off('click').on('click', function () {
                    var checked = $(this).prop('checked'),
                        $items = that.$selectItems;

                    if ($items.length === that.$selectItems.length) {
                        that[checked ? 'checkAll' : 'uncheckAll']();
                    } else {
                        // when the filter option is true
                        that.$selectGroups.prop('checked', checked);
                        $items.prop('checked', checked);
                        that.options[checked ? 'onCheckAll' : 'onUncheckAll']();
                        that.update();
                    }
                });
                this.$selectGroups.off('click').on('click', function () {
                    var group = $(this).parent().attr('data-group'),
                        $items = that.$selectItems.filter(':visible'),
                        $children = $items.filter(sprintf('[data-group="%s"]', group)),
                        checked = $children.length !== $children.filter(':checked').length;

                    $children.prop('checked', checked);
                    that.updateSelectAll();
                    that.update();
                    that.options.onOptgroupClick({
                        label: $(this).parent().text(),
                        checked: checked,
                        children: $children.get(),
                        instance: that
                    });
                });
                this.$selectItems.off('click').on('click', function () {
                    that.updateSelectAll();
                    that.update();
                    that.updateOptGroupSelect();
                    that.options.onClick({
                        label: $(this).parent().text(),
                        value: $(this).val(),
                        checked: $(this).prop('checked'),
                        instance: that
                    });

                    if (that.options.single && that.options.isOpen && !that.options.keepOpen) {
                        that.close();
                    }

                    if (that.options.single) {
                        var clickedVal = $(this).val();
                        that.$selectItems.filter(function () {
                            return $(this).val() !== clickedVal;
                        }).each(function () {
                            $(this).prop('checked', false);
                        });
                        that.update();
                    }
                });
            },

            open: function open() {
                if (this.$choice.hasClass('disabled')) {
                    return;
                }
                this.options.isOpen = true;
                this.$choice.find('>div').addClass('open');
                this.$drop[this.animateMethod('show')]();

                // fix filter bug: no results show
                this.$selectAll.parent().show();
                this.$noResults.hide();

                // Fix #77: 'All selected' when no options
                if (!this.$el.children().length) {
                    this.$selectAll.parent().hide();
                    this.$noResults.show();
                }

                if (this.options.container) {
                    var offset = this.$drop.offset();
                    this.$drop.appendTo($(this.options.container));
                    this.$drop.offset({
                        top: offset.top,
                        left: offset.left
                    });
                }

                if (this.options.filter) {
                    this.$searchInput.val('');
                    this.$searchInput.focus();
                    this.filter();
                }
                this.options.onOpen();
            },

            close: function close() {
                this.options.isOpen = false;
                this.$choice.find('>div').removeClass('open');
                this.$drop[this.animateMethod('hide')]();
                if (this.options.container) {
                    this.$parent.append(this.$drop);
                    this.$drop.css({
                        'top': 'auto',
                        'left': 'auto'
                    });
                }
                this.options.onClose();
            },

            animateMethod: function animateMethod(method) {
                var methods = {
                    show: {
                        fade: 'fadeIn',
                        slide: 'slideDown'
                    },
                    hide: {
                        fade: 'fadeOut',
                        slide: 'slideUp'
                    }
                };

                return methods[method][this.options.animate] || method;
            },

            update: function update(isInit) {
                var selects = this.options.displayValues ? this.getSelects() : this.getSelects('text'),
                    $span = this.$choice.find('>span'),
                    sl = selects.length;

                if (sl === 0) {
                    $span.addClass('placeholder').html(this.options.placeholder);
                } else if (this.options.allSelected && sl === this.$selectItems.length + this.$disableItems.length) {
                    $span.removeClass('placeholder').html(this.options.allSelected);
                } else if (this.options.ellipsis && sl > this.options.minimumCountSelected) {
                    $span.removeClass('placeholder').text(selects.slice(0, this.options.minimumCountSelected).join(this.options.delimiter) + '...');
                } else if (this.options.countSelected && sl > this.options.minimumCountSelected) {
                    $span.removeClass('placeholder').html(this.options.countSelected.replace('#', selects.length).replace('%', this.$selectItems.length + this.$disableItems.length));
                } else {
                    $span.removeClass('placeholder').text(selects.join(this.options.delimiter));
                }

                if (this.options.addTitle) {
                    $span.prop('title', this.getSelects('text'));
                }

                // set selects to select
                this.$el.val(this.getSelects()).trigger('change');

                // add selected class to selected li
                this.$drop.find('li').removeClass('selected');
                this.$drop.find('input:checked').each(function () {
                    $(this).parents('li').first().addClass('selected');
                });

                // trigger <select> change event
                if (!isInit) {
                    this.$el.trigger('change');
                }
            },

            updateSelectAll: function updateSelectAll(isInit) {
                var $items = this.$selectItems;

                if (!isInit) {
                    $items = $items.filter(':visible');
                }
                this.$selectAll.prop('checked', $items.length && $items.length === $items.filter(':checked').length);
                if (!isInit && this.$selectAll.prop('checked')) {
                    this.options.onCheckAll();
                }
            },

            updateOptGroupSelect: function updateOptGroupSelect() {
                var $items = this.$selectItems.filter(':visible');
                $.each(this.$selectGroups, function (i, val) {
                    var group = $(val).parent().attr('data-group'),
                        $children = $items.filter(sprintf('[data-group="%s"]', group));
                    $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
                });
            },

            //value or text, default: 'value'
            getSelects: function getSelects(type) {
                var that = this,
                    texts = [],
                    values = [];
                this.$drop.find(sprintf('input[%s]:checked', this.selectItemName)).each(function () {
                    texts.push($(this).parents('li').first().text());
                    values.push($(this).val());
                });

                if (type === 'text' && this.$selectGroups.length) {
                    texts = [];
                    this.$selectGroups.each(function () {
                        var html = [],
                            text = $.trim($(this).parent().text()),
                            group = $(this).parent().data('group'),
                            $children = that.$drop.find(sprintf('[%s][data-group="%s"]', that.selectItemName, group)),
                            $selected = $children.filter(':checked');

                        if (!$selected.length) {
                            return;
                        }

                        html.push('[');
                        html.push(text);
                        if ($children.length > $selected.length) {
                            var list = [];
                            $selected.each(function () {
                                list.push($(this).parent().text());
                            });
                            html.push(': ' + list.join(', '));
                        }
                        html.push(']');
                        texts.push(html.join(''));
                    });
                }
                return type === 'text' ? texts : values;
            },

            setSelects: function setSelects(values) {
                var that = this;
                this.$selectItems.prop('checked', false);
                this.$disableItems.prop('checked', false);
                $.each(values, function (i, value) {
                    that.$selectItems.filter(sprintf('[value="%s"]', value)).prop('checked', true);
                    that.$disableItems.filter(sprintf('[value="%s"]', value)).prop('checked', true);
                });
                this.$selectAll.prop('checked', this.$selectItems.length === this.$selectItems.filter(':checked').length + this.$disableItems.filter(':checked').length);

                $.each(that.$selectGroups, function (i, val) {
                    var group = $(val).parent().attr('data-group'),
                        $children = that.$selectItems.filter('[data-group="' + group + '"]');
                    $(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
                });

                this.update();
            },

            enable: function enable() {
                this.$choice.removeClass('disabled');
            },

            disable: function disable() {
                this.$choice.addClass('disabled');
            },

            checkAll: function checkAll() {
                this.$selectItems.prop('checked', true);
                this.$selectGroups.prop('checked', true);
                this.$selectAll.prop('checked', true);
                this.update();
                this.options.onCheckAll();
            },

            uncheckAll: function uncheckAll() {
                this.$selectItems.prop('checked', false);
                this.$selectGroups.prop('checked', false);
                this.$selectAll.prop('checked', false);
                this.update();
                this.options.onUncheckAll();
            },

            focus: function focus() {
                this.$choice.focus();
                this.options.onFocus();
            },

            blur: function blur() {
                this.$choice.blur();
                this.options.onBlur();
            },

            refresh: function refresh() {
                this.init();
            },

            destroy: function destroy() {
                this.$el.show();
                this.$parent.remove();
                this.$el.data('multipleSelect', null);
            },

            filter: function filter() {
                var that = this,
                    text = $.trim(this.$searchInput.val()).toLowerCase();

                if (text.length === 0) {
                    this.$selectAll.parent().show();
                    this.$selectItems.parent().show();
                    this.$disableItems.parent().show();
                    this.$selectGroups.parent().show();
                    this.$noResults.hide();
                } else {
                    this.$selectItems.each(function () {
                        var $parent = $(this).parent();
                        $parent[removeDiacritics($parent.text().toLowerCase()).indexOf(removeDiacritics(text)) < 0 ? 'hide' : 'show']();
                    });
                    this.$disableItems.parent().hide();
                    this.$selectGroups.each(function () {
                        var $parent = $(this).parent();
                        var group = $parent.attr('data-group'),
                            $items = that.$selectItems.filter(':visible');
                        $parent[$items.filter(sprintf('[data-group="%s"]', group)).length ? 'show' : 'hide']();
                    });

                    //Check if no matches found
                    if (this.$selectItems.parent().filter(':visible').length) {
                        this.$selectAll.parent().show();
                        this.$noResults.hide();
                    } else {
                        this.$selectAll.parent().hide();
                        this.$noResults.show();
                    }
                }
                this.updateOptGroupSelect();
                this.updateSelectAll();
                this.options.onFilter(text);
            }
        };

        $.fn.multipleSelect = function () {
            var option = arguments[0],
                args = arguments,
                value,
                allowedMethods = ['getSelects', 'setSelects', 'enable', 'disable', 'open', 'close', 'checkAll', 'uncheckAll', 'focus', 'blur', 'refresh', 'destroy'];

            this.each(function () {
                var $this = $(this),
                    data = $this.data('multipleSelect'),
                    options = $.extend({}, $.fn.multipleSelect.defaults, $this.data(), (typeof option === 'undefined' ? 'undefined' : _typeof(option)) === 'object' && option);

                if (!data) {
                    data = new MultipleSelect($this, options);
                    $this.data('multipleSelect', data);
                }

                if (typeof option === 'string') {
                    if ($.inArray(option, allowedMethods) < 0) {
                        throw 'Unknown method: ' + option;
                    }
                    value = data[option](args[1]);
                } else {
                    data.init();
                    if (args[1]) {
                        value = data[args[1]].apply(data, [].slice.call(args, 2));
                    }
                }
            });

            return typeof value !== 'undefined' ? value : this;
        };

        $.fn.multipleSelect.defaults = {
            name: '',
            isOpen: false,
            placeholder: '',
            selectAll: true,
            selectAllDelimiter: ['[', ']'],
            minimumCountSelected: 3,
            ellipsis: false,
            multiple: false,
            multipleWidth: 80,
            single: false,
            filter: false,
            width: undefined,
            dropWidth: undefined,
            maxHeight: 250,
            container: null,
            position: 'bottom',
            keepOpen: false,
            animate: 'none', // 'none', 'fade', 'slide'
            displayValues: false,
            delimiter: ', ',
            addTitle: false,
            filterAcceptOnEnter: false,
            hideOptgroupCheckboxes: false,

            selectAllText: '全选',
            allSelected: '全选',
            countSelected: '# of % selected',
            noMatchesFound: 'No matches found',

            styler: function styler() {
                return false;
            },
            textTemplate: function textTemplate($elm) {
                return $elm.html();
            },
            labelTemplate: function labelTemplate($elm) {
                return $elm.attr('label');
            },

            onOpen: function onOpen() {
                return false;
            },
            onClose: function onClose() {
                return false;
            },
            onCheckAll: function onCheckAll() {
                return false;
            },
            onUncheckAll: function onUncheckAll() {
                return false;
            },
            onFocus: function onFocus() {
                return false;
            },
            onBlur: function onBlur() {
                return false;
            },
            onOptgroupClick: function onOptgroupClick() {
                return false;
            },
            onClick: function onClick() {
                return false;
            },
            onFilter: function onFilter() {
                return false;
            }
        };
    })(jQuery);

    $(function () {
        $('.form-select-multiple').multipleSelect();
        // upload组件
        var uploadComponent = $('.form-upload');
        var uploadInput = uploadComponent.find('input');
        var content = '<p class="form-upload-content">' + '<i class="icon icon-upload"></i>上传附件' + '</p>';
        uploadComponent.append(content);
        uploadComponent.parent().find('.form-handle').hide();
        uploadInput.on('change', function (e) {
            var file = e.target.files[0];
            console.log(file);
            if (file) {
                $(this).parent().find('.form-upload-content').addClass('form-upload-content-text').html(file.name);
                $(this).parent().parent().find('.form-handle').show();
            }
        });
        $('.form-delete-file').click(function () {
            var $parentNode = $(this).parent();
            $parentNode.find('.form-handle').hide();
            $parentNode.find('input')[0].value = '';
            $parentNode.find('.form-upload-content').html('<i class="icon icon-upload"></i>上传附件').removeClass('form-upload-content-text');
        });
    });

    $(function () {
        var count = 204;
        var $desc = $('.detail-content .content .desc');
        var $more = $('.detail-content .content .more');
        var descText = $desc.text();
        $more.hide();
        if (descText.length > count) {
            $desc.html(descText.slice(0, count) + '……');
            $more.show();
        }
        $more.click(function () {
            $more.hide();
            $desc.html(descText);
        });
    });

    /*
   *	jQuery dotdotdot 3.2.2
   *	@requires jQuery 1.7.0 or later
   *
   *	dotdotdot.frebsite.nl
   *
   *	Copyright (c) Fred Heusschen
   *	www.frebsite.nl
   *
   *	License: CC-BY-NC-4.0
   *	http://creativecommons.org/licenses/by-nc/4.0/
   */

    (function ($) {

        var _PLUGIN_ = 'dotdotdot';
        var _VERSION_ = '3.2.2';

        if ($[_PLUGIN_] && $[_PLUGIN_].version > _VERSION_) {
            return;
        }

        /*
   	The class
   */
        $[_PLUGIN_] = function ($container, opts) {
            this.$dot = $container;
            this.api = ['getInstance', 'truncate', 'restore', 'destroy', 'watch', 'unwatch'];
            this.opts = opts;

            var oldAPI = this.$dot.data(_PLUGIN_);
            if (oldAPI) {
                oldAPI.destroy();
            }

            this.init();
            this.truncate();

            if (this.opts.watch) {
                this.watch();
            }

            return this;
        };

        $[_PLUGIN_].version = _VERSION_;
        $[_PLUGIN_].uniqueId = 0;

        $[_PLUGIN_].defaults = {
            ellipsis: '\u2026 ',
            callback: function callback(isTruncated) {
            },
            truncate: 'word',
            tolerance: 0,
            keep: null,
            watch: 'window',
            height: null
        };

        $[_PLUGIN_].prototype = {

            init: function init() {
                this.watchTimeout = null;
                this.watchInterval = null;
                this.uniqueId = $[_PLUGIN_].uniqueId++;
                this.originalStyle = this.$dot.attr('style') || '';
                this.originalContent = this._getOriginalContent();

                if (this.$dot.css('word-wrap') !== 'break-word') {
                    this.$dot.css('word-wrap', 'break-word');
                }
                if (this.$dot.css('white-space') === 'nowrap') {
                    this.$dot.css('white-space', 'normal');
                }

                if (this.opts.height === null) {
                    this.opts.height = this._getMaxHeight();
                }

                if (typeof this.opts.ellipsis == 'string') {
                    this.opts.ellipsis = document.createTextNode(this.opts.ellipsis);
                }
            },

            getInstance: function getInstance() {
                return this;
            },

            truncate: function truncate() {

                //	Add inner node for measuring the height
                this.$inner = this.$dot.wrapInner('<div />').children().css({
                    'display': 'block',
                    'height': 'auto',
                    'width': 'auto',
                    'border': 'none',
                    'padding': 0,
                    'margin': 0
                });

                //	Set original content
                this.$inner.empty().append(this.originalContent.clone(true));

                //	Get max height
                this.maxHeight = this._getMaxHeight();

                //	Truncate the text
                var isTruncated = false;
                if (!this._fits()) {
                    isTruncated = true;
                    this._truncateToNode(this.$inner[0]);
                }

                this.$dot[isTruncated ? 'addClass' : 'removeClass'](_c.truncated);

                //	Remove inner node
                this.$inner.replaceWith(this.$inner.contents());
                this.$inner = null;

                //	 Callback
                this.opts.callback.call(this.$dot[0], isTruncated);

                return isTruncated;
            },

            restore: function restore() {
                this.unwatch();

                this.$dot.empty().append(this.originalContent).attr('style', this.originalStyle).removeClass(_c.truncated);
            },

            destroy: function destroy() {
                this.restore();
                this.$dot.data(_PLUGIN_, null);
            },

            watch: function watch() {
                var that = this;

                this.unwatch();

                var oldSizes = {};

                if (this.opts.watch == 'window') {
                    $wndw.on(_e.resize + that.uniqueId, function (e) {
                        if (that.watchTimeout) {
                            clearTimeout(that.watchTimeout);
                        }
                        that.watchTimeout = setTimeout(function () {

                            oldSizes = that._watchSizes(oldSizes, $wndw, 'width', 'height');
                        }, 100);
                    });
                } else {
                    this.watchInterval = setInterval(function () {
                        oldSizes = that._watchSizes(oldSizes, that.$dot, 'innerWidth', 'innerHeight');
                    }, 500);
                }
            },

            unwatch: function unwatch() {
                $wndw.off(_e.resize + this.uniqueId);

                if (this.watchInterval) {
                    clearInterval(this.watchInterval);
                }

                if (this.watchTimeout) {
                    clearTimeout(this.watchTimeout);
                }
            },

            _api: function _api() {
                var that = this,
                    api = {};

                $.each(this.api, function (i) {
                    var fn = this;
                    api[fn] = function () {
                        var re = that[fn].apply(that, arguments);
                        return typeof re == 'undefined' ? api : re;
                    };
                });
                return api;
            },

            _truncateToNode: function _truncateToNode(_elem) {

                var _coms = [],
                    _elms = [];

                //	Empty the node
                //		-> replace all contents with comments
                $(_elem).contents().each(function () {
                    var $e = $(this);
                    if (!$e.hasClass(_c.keep)) {
                        var c = document.createComment('');
                        $e.replaceWith(c);

                        _elms.push(this);
                        _coms.push(c);
                    }
                });

                if (!_elms.length) {
                    return;
                }

                //	Re-fill the node
                //		-> replace comments with contents until it doesn't fit anymore
                for (var e = 0; e < _elms.length; e++) {

                    $(_coms[e]).replaceWith(_elms[e]);

                    $(_elms[e]).append(this.opts.ellipsis);
                    var fits = this._fits();
                    $(this.opts.ellipsis, _elms[e]).remove();

                    if (!fits) {
                        if (this.opts.truncate == 'node' && e > 1) {
                            $(_elms[e - 2]).remove();
                            return;
                        }
                        break;
                    }
                }

                //	Remove left over comments
                for (var c = e; c < _coms.length; c++) {
                    $(_coms[c]).remove();
                }

                //	Get last node
                //		-> the node that overflows

                var _last = _elms[Math.max(0, Math.min(e, _elms.length - 1))];

                //	Border case
                //		-> the last node with only an ellipsis in it...
                if (_last.nodeType == 1) {

                    var $e = $('<' + _last.nodeName + ' />');
                    $e.append(this.opts.ellipsis);

                    $(_last).replaceWith($e);

                    //	... fits
                    //		-> Restore the full last node
                    if (this._fits()) {
                        $e.replaceWith(_last);
                    }

                    //	... doesn't fit
                    //		-> remove it and go back one node
                    else {
                        $e.remove();
                        _last = _elms[Math.max(0, e - 1)];
                    }
                }

                //	Proceed inside last node
                if (_last.nodeType == 1) {
                    this._truncateToNode(_last);
                } else {
                    this._truncateToWord(_last);
                }
            },

            _truncateToWord: function _truncateToWord(_elem) {

                var e = _elem;

                var that = this;

                var txt = this.__getTextContent(e),
                    sep = txt.indexOf(' ') !== -1 ? ' ' : '\u3000',
                    arr = txt.split(sep),
                    str = '';

                for (var a = arr.length; a >= 0; a--) {
                    str = arr.slice(0, a).join(sep);

                    that.__setTextContent(e, that._addEllipsis(str));

                    if (that._fits()) {
                        if (that.opts.truncate == 'letter') {
                            that.__setTextContent(e, arr.slice(0, a + 1).join(sep));
                            that._truncateToLetter(e);
                        }
                        break;
                    }
                }
            },

            _truncateToLetter: function _truncateToLetter(e) {
                var that = this;

                var txt = this.__getTextContent(e),
                    arr = txt.split(''),
                    str = '';

                for (var a = arr.length; a >= 0; a--) {
                    str = arr.slice(0, a).join('');

                    if (!str.length) {
                        continue;
                    }

                    that.__setTextContent(e, that._addEllipsis(str));

                    if (that._fits()) {
                        break;
                    }
                }
            },

            _fits: function _fits() {
                return this.$inner.innerHeight() <= this.maxHeight + this.opts.tolerance;
            },

            _addEllipsis: function _addEllipsis(txt) {
                var remove = [' ', '\u3000', ',', ';', '.', '!', '?'];

                while ($.inArray(txt.slice(-1), remove) > -1) {
                    txt = txt.slice(0, -1);
                }
                txt += this.__getTextContent(this.opts.ellipsis);

                return txt;
            },

            _getOriginalContent: function _getOriginalContent() {
                var that = this;

                //	Add "keep" class to nodes to keep
                this.$dot.find('script, style').addClass(_c.keep);

                if (this.opts.keep) {
                    this.$dot.find(this.opts.keep).addClass(_c.keep);
                }

                //	Filter out unneeded whitespace
                this.$dot.find('*').not('.' + _c.keep).add(this.$dot).contents().each(function () {

                    var e = this,
                        $e = $(this);

                    //	Text nodes
                    if (e.nodeType == 3) {

                        //	Remove whitespace where it does not take up space in the DOM
                        if ($.trim(that.__getTextContent(e)) == '') {
                            if ($e.parent().is('table, thead, tbody, tfoot, tr, dl, ul, ol, video')) {
                                $e.remove();
                                return;
                            }
                            if ($e.prev().is('div, p, table, td, td, dt, dd, li')) {
                                $e.remove();
                                return;
                            }
                            if ($e.next().is('div, p, table, td, td, dt, dd, li')) {
                                $e.remove();
                                return;
                            }
                            if (!$e.prev().length) {
                                $e.remove();
                                return;
                            }
                            if (!$e.next().length) {
                                $e.remove();
                                return;
                            }
                        }
                    }

                    //	Comment nodes
                    else if (e.nodeType == 8) {
                        $e.remove();
                    }
                });

                return this.$dot.contents();
            },

            _getMaxHeight: function _getMaxHeight() {
                if (typeof this.opts.height == 'number') {
                    return this.opts.height;
                }

                //	Find smallest CSS height
                var arr = ['maxHeight', 'height'],
                    hgh = 0;

                for (var a = 0; a < arr.length; a++) {
                    hgh = window.getComputedStyle(this.$dot[0])[arr[a]];
                    if (hgh.slice(-2) == 'px') {
                        hgh = parseFloat(hgh);
                        break;
                    }
                }

                //	Remove padding-top/bottom when needed.
                var arr = [];
                switch (this.$dot.css('boxSizing')) {
                    case 'border-box':
                        arr.push('borderTopWidth');
                        arr.push('borderBottomWidth');
                    //	no break -> padding needs to be added too

                    case 'padding-box':
                        arr.push('paddingTop');
                        arr.push('paddingBottom');
                        break;
                }
                for (var a = 0; a < arr.length; a++) {
                    var p = window.getComputedStyle(this.$dot[0])[arr[a]];
                    if (p.slice(-2) == 'px') {
                        hgh -= parseFloat(p);
                    }
                }

                //	Sanitize
                return Math.max(hgh, 0);
            },

            _watchSizes: function _watchSizes(oldSizes, $elem, width, height) {
                if (this.$dot.is(':visible')) {
                    var newSizes = {
                        'width': $elem[width](),
                        'height': $elem[height]()
                    };

                    if (oldSizes.width != newSizes.width || oldSizes.height != newSizes.height) {
                        this.truncate();
                    }

                    return newSizes;
                }
                return oldSizes;
            },

            __getTextContent: function __getTextContent(elem) {
                var arr = ['nodeValue', 'textContent', 'innerText'];
                for (var a = 0; a < arr.length; a++) {
                    if (typeof elem[arr[a]] == 'string') {
                        return elem[arr[a]];
                    }
                }
                return '';
            },
            __setTextContent: function __setTextContent(elem, content) {
                var arr = ['nodeValue', 'textContent', 'innerText'];
                for (var a = 0; a < arr.length; a++) {
                    elem[arr[a]] = content;
                }
            }
        };

        /*
   	The jQuery plugin
   */
        $.fn[_PLUGIN_] = function (opts) {
            initPlugin();

            opts = $.extend(true, {}, $[_PLUGIN_].defaults, opts);

            return this.each(function () {
                $(this).data(_PLUGIN_, new $[_PLUGIN_]($(this), opts)._api());
            });
        };

        /*
   	Global variables
   */
        var _c, _d, _e, $wndw;

        function initPlugin() {
            $wndw = $(window);

            //	Classnames, Datanames, Eventnames
            _c = {};
            _d = {};
            _e = {};

            $.each([_c, _d, _e], function (i, o) {
                o.add = function (a) {
                    a = a.split(' ');
                    for (var b = 0, l = a.length; b < l; b++) {
                        o[a[b]] = o.ddd(a[b]);
                    }
                };
            });

            //	Classnames
            _c.ddd = function (c) {
                return 'ddd-' + c;
            };
            _c.add('truncated keep');

            //	Datanames
            _d.ddd = function (d) {
                return 'ddd-' + d;
            };

            //	Eventnames
            _e.ddd = function (e) {
                return e + '.ddd';
            };
            _e.add('resize');

            //	Only once
            initPlugin = function initPlugin() {
            };
        }
    })(jQuery);

    /*!
   * Datepicker v0.6.5
   * https://github.com/fengyuanchen/datepicker
   *
   * Copyright (c) 2014-2018 Chen Fengyuan
   * Released under the MIT license
   *
   * Date: 2018-03-31T06:17:11.587Z
   */
    !function (t) {
        t($);
    }(function (D) {
        D = D && D.hasOwnProperty("default") ? D.default : D;
        var a = {
                autoShow: !1,
                autoHide: !1,
                autoPick: !1,
                inline: !1,
                container: null,
                trigger: null,
                language: "",
                format: "mm/dd/yyyy",
                date: null,
                startDate: null,
                endDate: null,
                startView: 0,
                weekStart: 0,
                yearFirst: !1,
                yearSuffix: "",
                days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
                daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
                daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
                months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
                monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
                itemTag: "li",
                mutedClass: "muted",
                pickedClass: "picked",
                disabledClass: "disabled",
                highlightedClass: "highlighted",
                template: '<div class="datepicker-container"><div class="datepicker-panel" data-view="years picker"><ul><li data-view="years prev">&lsaquo;</li><li data-view="years current"></li><li data-view="years next">&rsaquo;</li></ul><ul data-view="years"></ul></div><div class="datepicker-panel" data-view="months picker"><ul><li data-view="year prev">&lsaquo;</li><li data-view="year current"></li><li data-view="year next">&rsaquo;</li></ul><ul data-view="months"></ul></div><div class="datepicker-panel" data-view="days picker"><ul><li data-view="month prev">&lsaquo;</li><li data-view="month current"></li><li data-view="month next">&rsaquo;</li></ul><ul data-view="week"></ul><ul data-view="days"></ul></div></div>',
                offset: 10,
                zIndex: 1e3,
                filter: null,
                show: null,
                hide: null,
                pick: null
            },
            e = "undefined" != typeof window ? window : {},
            d = "datepicker",
            s = "click." + d,
            n = "focus." + d,
            r = "hide." + d,
            h = "keyup." + d,
            o = "pick." + d,
            t = "resize." + d,
            l = "show." + d,
            u = d + "-hide",
            c = {},
            p = 0,
            f = 1,
            g = 2,
            i = Object.prototype.toString;

        function y(e) {
            return "string" == typeof e;
        }

        var v = Number.isNaN || e.isNaN;

        function m(e) {
            return "number" == typeof e && !v(e);
        }

        function w(e) {
            return void 0 === e;
        }

        function k(e) {
            return "date" === (t = e, i.call(t).slice(8, -1).toLowerCase());
            var t;
        }

        function b(a, s) {
            for (var e = arguments.length, n = Array(2 < e ? e - 2 : 0), t = 2; t < e; t++) {
                n[t - 2] = arguments[t];
            }
            return function () {
                for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) {
                    t[i] = arguments[i];
                }
                return a.apply(s, n.concat(t));
            };
        }

        function C(e) {
            return '[data-view="' + e + '"]';
        }

        function G(e, t) {
            return [31, (i = e, i % 4 == 0 && i % 100 != 0 || i % 400 == 0 ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][t];
            var i;
        }

        function $(e, t, i) {
            return Math.min(i, G(e, t));
        }

        var x = /(y|m|d)+/g;
        var F = /\d+/g,
            M = {
                show: function show() {
                    this.built || this.build(), this.shown || this.trigger(l).isDefaultPrevented() || (this.shown = !0, this.$picker.removeClass(u).on(s, D.proxy(this.click, this)), this.showView(this.options.startView), this.inline || (D(window).on(t, this.onResize = b(this.place, this)), D(document).on(s, this.onGlobalClick = b(this.globalClick, this)), D(document).on(h, this.onGlobalKeyup = b(this.globalKeyup, this)), this.place()));
                }, hide: function hide() {
                    this.shown && (this.trigger(r).isDefaultPrevented() || (this.shown = !1, this.$picker.addClass(u).off(s, this.click), this.inline || (D(window).off(t, this.onResize), D(document).off(s, this.onGlobalClick), D(document).off(h, this.onGlobalKeyup))));
                }, toggle: function toggle() {
                    this.shown ? this.hide() : this.show();
                }, update: function update() {
                    var e = this.getValue();
                    e !== this.oldValue && (this.setDate(e, !0), this.oldValue = e);
                }, pick: function pick(e) {
                    var t = this.$element,
                        i = this.date;
                    this.trigger(o, {
                        view: e || "",
                        date: i
                    }).isDefaultPrevented() || (i = this.formatDate(this.date), this.setValue(i), this.isInput && (t.trigger("input"), t.trigger("change")));
                }, reset: function reset() {
                    this.setDate(this.initialDate, !0), this.setValue(this.initialValue), this.shown && this.showView(this.options.startView);
                }, getMonthName: function getMonthName(e, t) {
                    var i = this.options,
                        a = i.monthsShort,
                        s = i.months;
                    return D.isNumeric(e) ? e = Number(e) : w(t) && (t = e), !0 === t && (s = a), s[m(e) ? e : this.date.getMonth()];
                }, getDayName: function getDayName(e, t, i) {
                    var a = this.options,
                        s = a.days;
                    return D.isNumeric(e) ? e = Number(e) : (w(i) && (i = t), w(t) && (t = e)), i ? s = a.daysMin : t && (s = a.daysShort), s[m(e) ? e : this.date.getDay()];
                }, getDate: function getDate(e) {
                    var t = this.date;
                    return e ? this.formatDate(t) : new Date(t);
                }, setDate: function setDate(e, t) {
                    var i = this.options.filter;
                    if (k(e) || y(e)) {
                        if (e = this.parseDate(e), D.isFunction(i) && !1 === i.call(this.$element, e)) return;
                        this.date = e, this.viewDate = new Date(e), t || this.pick(), this.built && this.render();
                    }
                }, setStartDate: function setStartDate(e) {
                    (k(e) || y(e)) && (this.startDate = this.parseDate(e), this.built && this.render());
                }, setEndDate: function setEndDate(e) {
                    (k(e) || y(e)) && (this.endDate = this.parseDate(e), this.built && this.render());
                }, parseDate: function parseDate(e) {
                    var a = this.format,
                        t = [];
                    if (k(e)) return new Date(e.getFullYear(), e.getMonth(), e.getDate());
                    y(e) && (t = e.match(F) || []), e = new Date();
                    var i = a.parts.length,
                        s = e.getFullYear(),
                        n = e.getDate(),
                        r = e.getMonth();
                    return t.length === i && D.each(t, function (e, t) {
                        var i = parseInt(t, 10) || 1;
                        switch (a.parts[e]) {
                            case "dd":
                            case "d":
                                n = i;
                                break;
                            case "mm":
                            case "m":
                                r = i - 1;
                                break;
                            case "yy":
                                s = 2e3 + i;
                                break;
                            case "yyyy":
                                s = i;
                        }
                    }), new Date(s, r, n);
                }, formatDate: function formatDate(e) {
                    var t = this.format,
                        i = "";
                    if (k(e)) {
                        var a = e.getFullYear(),
                            s = {d: e.getDate(), m: e.getMonth() + 1, yy: a.toString().substring(2), yyyy: a};
                        s.dd = (s.d < 10 ? "0" : "") + s.d, s.mm = (s.m < 10 ? "0" : "") + s.m, i = t.source, D.each(t.parts, function (e, t) {
                            i = i.replace(t, s[t]);
                        });
                    }
                    return i;
                }, destroy: function destroy() {
                    this.unbind(), this.unbuild(), this.$element.removeData(d);
                }
            },
            V = {
                click: function click(e) {
                    var t = D(e.target),
                        i = this.options,
                        a = this.viewDate,
                        s = this.format;
                    if (e.stopPropagation(), e.preventDefault(), !t.hasClass("disabled")) {
                        var n = t.data("view"),
                            r = a.getFullYear(),
                            h = a.getMonth(),
                            o = a.getDate();
                        switch (n) {
                            case "years prev":
                            case "years next":
                                r = "years prev" === n ? r - 10 : r + 10, this.viewDate = new Date(r, h, $(r, h, o)), this.renderYears();
                                break;
                            case "year prev":
                            case "year next":
                                r = "year prev" === n ? r - 1 : r + 1, this.viewDate = new Date(r, h, $(r, h, o)), this.renderMonths();
                                break;
                            case "year current":
                                s.hasYear && this.showView(g);
                                break;
                            case "year picked":
                                s.hasMonth ? this.showView(f) : (t.addClass(i.pickedClass).siblings().removeClass(i.pickedClass), this.hideView()), this.pick("year");
                                break;
                            case "year":
                                r = parseInt(t.text(), 10), this.date = new Date(r, h, $(r, h, o)), s.hasMonth ? (this.viewDate = new Date(this.date), this.showView(f)) : (t.addClass(i.pickedClass).siblings().removeClass(i.pickedClass), this.hideView()), this.pick("year");
                                break;
                            case "month prev":
                            case "month next":
                                (h = "month prev" === n ? h - 1 : h + 1) < 0 ? (r -= 1, h += 12) : 11 < h && (r += 1, h -= 12), this.viewDate = new Date(r, h, $(r, h, o)), this.renderDays();
                                break;
                            case "month current":
                                s.hasMonth && this.showView(f);
                                break;
                            case "month picked":
                                s.hasDay ? this.showView(p) : (t.addClass(i.pickedClass).siblings().removeClass(i.pickedClass), this.hideView()), this.pick("month");
                                break;
                            case "month":
                                h = D.inArray(t.text(), i.monthsShort), this.date = new Date(r, h, $(r, h, o)), s.hasDay ? (this.viewDate = new Date(r, h, $(r, h, o)), this.showView(p)) : (t.addClass(i.pickedClass).siblings().removeClass(i.pickedClass), this.hideView()), this.pick("month");
                                break;
                            case "day prev":
                            case "day next":
                            case "day":
                                "day prev" === n ? h -= 1 : "day next" === n && (h += 1), o = parseInt(t.text(), 10), this.date = new Date(r, h, o), this.viewDate = new Date(r, h, o), this.renderDays(), "day" === n && this.hideView(), this.pick("day");
                                break;
                            case "day picked":
                                this.hideView(), this.pick("day");
                        }
                    }
                }, globalClick: function globalClick(e) {
                    for (var t = e.target, i = this.element, a = this.$trigger[0], s = !0; t !== document;) {
                        if (t === a || t === i) {
                            s = !1;
                            break;
                        }
                        t = t.parentNode;
                    }
                    s && this.hide();
                }, keyup: function keyup() {
                    this.update();
                }, globalKeyup: function globalKeyup(e) {
                    var t = e.target,
                        i = e.key,
                        a = e.keyCode;
                    this.isInput && t !== this.element && this.shown && ("Tab" === i || 9 === a) && this.hide();
                }
            },
            Y = {
                render: function render() {
                    this.renderYears(), this.renderMonths(), this.renderDays();
                }, renderWeek: function renderWeek() {
                    var i = this,
                        a = [],
                        e = this.options,
                        t = e.weekStart,
                        s = e.daysMin;
                    t = parseInt(t, 10) % 7, s = s.slice(t).concat(s.slice(0, t)), D.each(s, function (e, t) {
                        a.push(i.createItem({text: t}));
                    }), this.$week.html(a.join(""));
                }, renderYears: function renderYears() {
                    var e = this.options,
                        t = this.startDate,
                        i = this.endDate,
                        a = e.disabledClass,
                        s = e.filter,
                        n = e.yearSuffix,
                        r = this.viewDate.getFullYear(),
                        h = new Date().getFullYear(),
                        o = this.date.getFullYear(),
                        l = [],
                        d = !1,
                        u = !1,
                        c = void 0;
                    for (c = -5; c <= 6; c += 1) {
                        var p = new Date(r + c, 1, 1),
                            f = !1;
                        t && (f = p.getFullYear() < t.getFullYear(), -5 === c && (d = f)), !f && i && (f = p.getFullYear() > i.getFullYear(), 6 === c && (u = f)), !f && s && (f = !1 === s.call(this.$element, p));
                        var g = r + c === o,
                            y = g ? "year picked" : "year";
                        l.push(this.createItem({
                            picked: g,
                            disabled: f,
                            text: r + c,
                            view: f ? "year disabled" : y,
                            highlighted: p.getFullYear() === h
                        }));
                    }
                    this.$yearsPrev.toggleClass(a, d), this.$yearsNext.toggleClass(a, u), this.$yearsCurrent.toggleClass(a, !0).html(r + -5 + n + " - " + (r + 6) + n), this.$years.html(l.join(""));
                }, renderMonths: function renderMonths() {
                    var e = this.options,
                        t = this.startDate,
                        i = this.endDate,
                        a = this.viewDate,
                        s = e.disabledClass || "",
                        n = e.monthsShort,
                        r = D.isFunction(e.filter) && e.filter,
                        h = a.getFullYear(),
                        o = new Date(),
                        l = o.getFullYear(),
                        d = o.getMonth(),
                        u = this.date.getFullYear(),
                        c = this.date.getMonth(),
                        p = [],
                        f = !1,
                        g = !1,
                        y = void 0;
                    for (y = 0; y <= 11; y += 1) {
                        var v = new Date(h, y, 1),
                            m = !1;
                        t && (m = (f = v.getFullYear() === t.getFullYear()) && v.getMonth() < t.getMonth()), !m && i && (m = (g = v.getFullYear() === i.getFullYear()) && v.getMonth() > i.getMonth()), !m && r && (m = !1 === r.call(this.$element, v));
                        var w = h === u && y === c,
                            k = w ? "month picked" : "month";
                        p.push(this.createItem({
                            disabled: m,
                            picked: w,
                            highlighted: h === l && v.getMonth() === d,
                            index: y,
                            text: n[y],
                            view: m ? "month disabled" : k
                        }));
                    }
                    this.$yearPrev.toggleClass(s, f), this.$yearNext.toggleClass(s, g), this.$yearCurrent.toggleClass(s, f && g).html(h + e.yearSuffix || ""), this.$months.html(p.join(""));
                }, renderDays: function renderDays() {
                    var e = this.$element,
                        t = this.options,
                        i = this.startDate,
                        a = this.endDate,
                        s = this.viewDate,
                        n = this.date,
                        r = t.disabledClass,
                        h = t.filter,
                        o = t.monthsShort,
                        l = t.weekStart,
                        d = t.yearSuffix,
                        u = s.getFullYear(),
                        c = s.getMonth(),
                        p = new Date(),
                        f = p.getFullYear(),
                        g = p.getMonth(),
                        y = p.getDate(),
                        v = n.getFullYear(),
                        m = n.getMonth(),
                        w = n.getDate(),
                        k = void 0,
                        D = void 0,
                        b = void 0,
                        C = [],
                        $ = u,
                        x = c,
                        F = !1;
                    0 === c ? ($ -= 1, x = 11) : x -= 1, k = G($, x);
                    var M = new Date(u, c, 1);
                    for ((b = M.getDay() - parseInt(l, 10) % 7) <= 0 && (b += 7), i && (F = M.getTime() <= i.getTime()), D = k - (b - 1); D <= k; D += 1) {
                        var V = new Date($, x, D),
                            Y = !1;
                        i && (Y = V.getTime() < i.getTime()), !Y && h && (Y = !1 === h.call(e, V)), C.push(this.createItem({
                            disabled: Y,
                            highlighted: $ === f && x === g && V.getDate() === y,
                            muted: !0,
                            picked: $ === v && x === m && D === w,
                            text: D,
                            view: "day prev"
                        }));
                    }
                    var I = [],
                        S = u,
                        T = c,
                        N = !1;
                    11 === c ? (S += 1, T = 0) : T += 1, k = G(u, c), b = 42 - (C.length + k);
                    var P = new Date(u, c, k);
                    for (a && (N = P.getTime() >= a.getTime()), D = 1; D <= b; D += 1) {
                        var j = new Date(S, T, D),
                            q = S === v && T === m && D === w,
                            A = !1;
                        a && (A = j.getTime() > a.getTime()), !A && h && (A = !1 === h.call(e, j)), I.push(this.createItem({
                            disabled: A,
                            picked: q,
                            highlighted: S === f && T === g && j.getDate() === y,
                            muted: !0,
                            text: D,
                            view: "day next"
                        }));
                    }
                    var W = [];
                    for (D = 1; D <= k; D += 1) {
                        var z = new Date(u, c, D),
                            J = !1;
                        i && (J = z.getTime() < i.getTime()), !J && a && (J = z.getTime() > a.getTime()), !J && h && (J = !1 === h.call(e, z));
                        var O = u === v && c === m && D === w,
                            E = O ? "day picked" : "day";
                        W.push(this.createItem({
                            disabled: J,
                            picked: O,
                            highlighted: u === f && c === g && z.getDate() === y,
                            text: D,
                            view: J ? "day disabled" : E
                        }));
                    }
                    this.$monthPrev.toggleClass(r, F), this.$monthNext.toggleClass(r, N), this.$monthCurrent.toggleClass(r, F && N).html(t.yearFirst ? u + d + " " + o[c] : o[c] + " " + u + d), this.$days.html(C.join("") + W.join("") + I.join(""));
                }
            },
            I = function () {
                function a(e, t) {
                    for (var i = 0; i < t.length; i++) {
                        var a = t[i];
                        a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(e, a.key, a);
                    }
                }

                return function (e, t, i) {
                    return t && a(e.prototype, t), i && a(e, i), e;
                };
            }();
        var S = d + "-top-left",
            T = d + "-bottom-left",
            N = [S, d + "-top-right", T, d + "-bottom-right"].join(" "),
            P = function () {
                function i(e) {
                    var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
                    !function (e, t) {
                        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
                    }(this, i), this.$element = D(e), this.element = e, this.options = D.extend({}, a, c[t.language], t), this.built = !1, this.shown = !1, this.isInput = !1, this.inline = !1, this.initialValue = "", this.initialDate = null, this.startDate = null, this.endDate = null, this.init();
                }

                return I(i, [{
                    key: "init", value: function value() {
                        var e = this.$element,
                            t = this.options,
                            i = t.startDate,
                            a = t.endDate,
                            s = t.date;
                        this.$trigger = D(t.trigger), this.isInput = e.is("input") || e.is("textarea"), this.inline = t.inline && (t.container || !this.isInput), this.format = function (i) {
                            var e = String(i).toLowerCase(),
                                t = e.match(x);
                            if (!t || 0 === t.length) throw new Error("Invalid date format.");
                            return i = {source: e, parts: t}, D.each(t, function (e, t) {
                                switch (t) {
                                    case "dd":
                                    case "d":
                                        i.hasDay = !0;
                                        break;
                                    case "mm":
                                    case "m":
                                        i.hasMonth = !0;
                                        break;
                                    case "yyyy":
                                    case "yy":
                                        i.hasYear = !0;
                                }
                            }), i;
                        }(t.format);
                        var n = this.getValue();
                        this.initialValue = n, this.oldValue = n, s = this.parseDate(s || n), i && (i = this.parseDate(i), s.getTime() < i.getTime() && (s = new Date(i)), this.startDate = i), a && (a = this.parseDate(a), i && a.getTime() < i.getTime() && (a = new Date(i)), s.getTime() > a.getTime() && (s = new Date(a)), this.endDate = a), this.date = s, this.viewDate = new Date(s), this.initialDate = new Date(this.date), this.bind(), (t.autoShow || this.inline) && this.show(), t.autoPick && this.pick();
                    }
                }, {
                    key: "build", value: function value() {
                        if (!this.built) {
                            this.built = !0;
                            var e = this.$element,
                                t = this.options,
                                i = D(t.template);
                            this.$picker = i, this.$week = i.find(C("week")), this.$yearsPicker = i.find(C("years picker")), this.$yearsPrev = i.find(C("years prev")), this.$yearsNext = i.find(C("years next")), this.$yearsCurrent = i.find(C("years current")), this.$years = i.find(C("years")), this.$monthsPicker = i.find(C("months picker")), this.$yearPrev = i.find(C("year prev")), this.$yearNext = i.find(C("year next")), this.$yearCurrent = i.find(C("year current")), this.$months = i.find(C("months")), this.$daysPicker = i.find(C("days picker")), this.$monthPrev = i.find(C("month prev")), this.$monthNext = i.find(C("month next")), this.$monthCurrent = i.find(C("month current")), this.$days = i.find(C("days")), this.inline ? D(t.container || e).append(i.addClass(d + "-inline")) : (D(document.body).append(i.addClass(d + "-dropdown")), i.addClass(u)), this.renderWeek();
                        }
                    }
                }, {
                    key: "unbuild", value: function value() {
                        this.built && (this.built = !1, this.$picker.remove());
                    }
                }, {
                    key: "bind", value: function value() {
                        var e = this.options,
                            t = this.$element;
                        D.isFunction(e.show) && t.on(l, e.show), D.isFunction(e.hide) && t.on(r, e.hide), D.isFunction(e.pick) && t.on(o, e.pick), this.isInput && t.on(h, D.proxy(this.keyup, this)), this.inline || (e.trigger ? this.$trigger.on(s, D.proxy(this.toggle, this)) : this.isInput ? t.on(n, D.proxy(this.show, this)) : t.on(s, D.proxy(this.show, this)));
                    }
                }, {
                    key: "unbind", value: function value() {
                        var e = this.$element,
                            t = this.options;
                        D.isFunction(t.show) && e.off(l, t.show), D.isFunction(t.hide) && e.off(r, t.hide), D.isFunction(t.pick) && e.off(o, t.pick), this.isInput && e.off(h, this.keyup), this.inline || (t.trigger ? this.$trigger.off(s, this.toggle) : this.isInput ? e.off(n, this.show) : e.off(s, this.show));
                    }
                }, {
                    key: "showView", value: function value(e) {
                        var t = this.$yearsPicker,
                            i = this.$monthsPicker,
                            a = this.$daysPicker,
                            s = this.format;
                        if (s.hasYear || s.hasMonth || s.hasDay) switch (Number(e)) {
                            case g:
                                i.addClass(u), a.addClass(u), s.hasYear ? (this.renderYears(), t.removeClass(u), this.place()) : this.showView(p);
                                break;
                            case f:
                                t.addClass(u), a.addClass(u), s.hasMonth ? (this.renderMonths(), i.removeClass(u), this.place()) : this.showView(g);
                                break;
                            default:
                                t.addClass(u), i.addClass(u), s.hasDay ? (this.renderDays(), a.removeClass(u), this.place()) : this.showView(f);
                        }
                    }
                }, {
                    key: "hideView", value: function value() {
                        !this.inline && this.options.autoHide && this.hide();
                    }
                }, {
                    key: "place", value: function value() {
                        if (!this.inline) {
                            var e = this.$element,
                                t = this.options,
                                i = this.$picker,
                                a = D(document).outerWidth(),
                                s = D(document).outerHeight(),
                                n = e.outerWidth(),
                                r = e.outerHeight(),
                                h = i.width(),
                                o = i.height(),
                                l = e.offset(),
                                d = l.left,
                                u = l.top,
                                c = parseFloat(t.offset),
                                p = S;
                            v(c) && (c = 10), o < u && s < u + r + o ? (u -= o + c, p = T) : u += r + c, a < d + h && (d += n - h, p = p.replace("left", "right")), i.removeClass(N).addClass(p).css({
                                top: u,
                                left: d,
                                zIndex: parseInt(t.zIndex, 10)
                            });
                        }
                    }
                }, {
                    key: "trigger", value: function value(e, t) {
                        var i = D.Event(e, t);
                        return this.$element.trigger(i), i;
                    }
                }, {
                    key: "createItem", value: function value(e) {
                        var t = this.options,
                            i = t.itemTag,
                            a = {text: "", view: "", muted: !1, picked: !1, disabled: !1, highlighted: !1},
                            s = [];
                        return D.extend(a, e), a.muted && s.push(t.mutedClass), a.highlighted && s.push(t.highlightedClass), a.picked && s.push(t.pickedClass), a.disabled && s.push(t.disabledClass), "<" + i + ' class="' + s.join(" ") + '" data-view="' + a.view + '">' + a.text + "</" + i + ">";
                    }
                }, {
                    key: "getValue", value: function value() {
                        var e = this.$element;
                        return this.isInput ? e.val() : e.text();
                    }
                }, {
                    key: "setValue", value: function value() {
                        var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "",
                            t = this.$element;
                        this.isInput ? t.val(e) : t.text(e);
                    }
                }], [{
                    key: "setDefaults", value: function value() {
                        var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
                        D.extend(a, c[e.language], e);
                    }
                }]), i;
            }();
        if (D.extend && D.extend(P.prototype, Y, V, M), D.fn) {
            var j = D.fn.datepicker;
            D.fn.datepicker = function (h) {
                for (var e = arguments.length, o = Array(1 < e ? e - 1 : 0), t = 1; t < e; t++) {
                    o[t - 1] = arguments[t];
                }
                var l = void 0;
                return this.each(function (e, t) {
                    var i = D(t),
                        a = "destroy" === h,
                        s = i.data(d);
                    if (!s) {
                        if (a) return;
                        var n = D.extend({}, i.data(), D.isPlainObject(h) && h);
                        s = new P(t, n), i.data(d, s);
                    }
                    if (y(h)) {
                        var r = s[h];
                        D.isFunction(r) && (l = r.apply(s, o), a && i.removeData(d));
                    }
                }), w(l) ? this : l;
            }, D.fn.datepicker.Constructor = P, D.fn.datepicker.languages = c, D.fn.datepicker.setDefaults = P.setDefaults, D.fn.datepicker.noConflict = function () {
                return D.fn.datepicker = j, this;
            };
        }
    });

    $.fn.datepicker.languages['zh-CN'] = {
        format: 'yyyy年mm月dd日',
        days: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
        daysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
        daysMin: ['日', '一', '二', '三', '四', '五', '六'],
        months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
        monthsShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
        weekStart: 1,
        startView: 0,
        yearFirst: true,
        yearSuffix: '年'
    };

    $(function () {
        var defaults = {
            language: 'zh-CN',
            format: 'yyyy/mm/dd',
            autoHide: true
        };

        $('.datepicker').each(function () {
            var $this = $(this);
            var options = JSON.parse($this.attr('data-options') || null);
            $this.find('input').datepicker($.extend({}, defaults, options));
        });
    });

    /*通用弹框*/
    (function (window, $) {

        //add by bjca begin
        $('#loading').remove();
        //add by bjca end

        //初始化html
        var html = '<div id="loading">\n    <div class="loading-mask"></div>\n    <div class="loading-box">\n      <span class="ani_loading"></span>\n      <p class="loading-text"></p>\n    </div>\n  </div>';
        $(document.body).append(html);

        //loading方法
        var loading = window.loading = function () {
            var $loading = $('#loading'),
                $loadingText = $loading.find('.loading-text'),
                $loadingMask = $loading.find('.loading-mask'),
                opts;

            return {
                show: function show(options) {
                    //配置项
                    (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' && (options = {loadingText: options});
                    opts = $.extend({}, loading.defaults, options);

                    opts.withMask ? $loadingMask.removeClass('hidden') : $loadingMask.addClass('hidden');

                    // loading文字
                    $loadingText.html(opts.loadingText);

                    // 显示
                    $loading.addClass('visible');
                },
                hide: function hide() {
                    // 隐藏
                    $loading.removeClass('visible');
                }
            };
        }();
        loading.defaults = {
            loadingText: '加载中...',
            withMask: true
        };
    })(window, $);

    /*通用弹框*/
    (function (window, $) {

        //add by bjca begin
        $('#notification').remove();
        //add by bjca end

        // 初始化html
        var html = '<div id="notification">\n    <a class="btn-close"></a>\n    <div class="content">\n    </div>\n    <div class="btn-wrapper">\n      <a class="btn-prev btn btn-small btn-default">\u4E0A\u4E00\u6761</a>\n      <a class="btn-next btn btn-small btn-default">\u4E0B\u4E00\u6761</a>\n    </div>\n  </div>';
        $(document.body).append(html);

        // notification方法
        var notification = window.notification = function () {
            var $notification = $('#notification');
            var $content = $notification.find('.content');
            var $btnPrev = $notification.find('.btn-prev');
            var $btnNext = $notification.find('.btn-next');

            var opts = void 0;
            var activeIndex = void 0;
            var $items = void 0;

            // 关闭按钮
            $notification.on('click', '.btn-close', function () {
                // 关闭窗口
                $notification.removeClass('visible');
                opts.onClose && opts.onClose();
            });

            // 上一条
            $notification.on('click', '.btn-prev', function () {
                indexItem(--activeIndex);
                opts.btnPrevClick && opts.btnPrevClick(activeIndex);
            });

            // 下一条
            $notification.on('click', '.btn-next', function () {
                indexItem(++activeIndex);
            });

            function indexItem(index) {
                index <= 0 ? $btnPrev.addClass('btn-disabled') : $btnPrev.removeClass('btn-disabled');
                index >= $items.length - 1 ? $btnNext.addClass('btn-disabled') : $btnNext.removeClass('btn-disabled');
                $items.removeClass('active').eq(index).addClass('active');
            }

            return function (options) {
                //配置项
                (typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object' && (options = {data: options});
                opts = $.extend({}, notification.defaults, options);

                var _opts = opts,
                    data = _opts.data,
                    initIndex = _opts.initIndex;

                activeIndex = initIndex;

                // 内容
                $content.html(data.map(function (item) {
                    return '<div class="notification-item">\n          <h3 class="notification-title">' + item.title + '</h3>\n          <div class="notification-content">' + item.content + '</div>\n        </div>';
                }).join(''));

                $items = $content.find('.notification-item');

                // 定位
                indexItem(activeIndex);

                //打开窗口
                $notification.addClass('visible');
            };
        }();
        notification.defaults = {
            // 关闭回调
            onClose: null,
            // 数据
            data: null,
            // 初始index
            initIndex: 0,
            // 上一条回调
            btnPrevClick: null,
            // 下一条回调
            btnNextClick: null
        };
    })(window, $);

    $(function () {

        function setSelectStar() {
            $(this).parent().find('.icon').each(function (item) {
                $(this).removeClass('selected');
                if ($(this).hasClass('active')) {
                    $(this).addClass('selected');
                }
            });
        }

        function getIndex(type) {
            return $(this).parent().find('.' + type).size() - 1;
        }

        function setReplyText(type) {
            var descText = ['(非常不满意)', '(不满意)', '(基本满意)', '(满意)', '(非常满意)'];
            var index = getIndex.call(this, type);
            var $starDesc = $(this).parent().find('.starDesc');
            $starDesc.show();
            if (index >= 0) {
                $starDesc.text(descText[index]);
            } else {
                $starDesc.hide();
            }
        }

        function setActiveStar() {
            var current = $(this);
            while (current) {
                current.addClass('active');
                var prev = current.prev();
                if (prev && prev.hasClass('icon')) {
                    current = prev;
                } else {
                    current = undefined;
                }
            }
        }

        function removeActiveStar() {
            $(this).parent().find('.icon').removeClass('active');
        }

        function setSelectEvent() {
            var $parent = $(this).parent();
            $parent.trigger('select', [{
                level: getIndex.call(this, 'selected') + 1
            }]);
        }

        $('.grade-star .icon-star').on('mouseenter', function () {
            setActiveStar.call(this);
            setReplyText.call(this, 'active');
        }).on('mouseleave', function () {
            removeActiveStar.call(this);
            setReplyText.call(this, 'selected');
        }).on('click', function () {
            setSelectStar.call(this);
            setReplyText.call(this, 'selected');
            setSelectEvent.call(this);
        });

        // init
        $('.grade-star .icon-star').each(function () {
            setReplyText.call(this, 'selected');
        });
    });

    // import TA from './analytics';

})));
